/**
 *  Mutator for testing certain bug that leads to crashes.
 */
class KFCrashMut extends Mutator;

struct SubStruct
{
    var string key;
    var int value;
};

struct SomeStruct
{
    var array<SubStruct> records;
};

function SomeStruct ModStruct(SomeStruct s)
{
    return s;
}

function Mutate(string command, PlayerController sendingPlayer)
{
    local int           i;
    local SomeStruct    s;
    if (command != "crash") return;
    //  This doesn't crash server:
    ModStruct(s);
    ModStruct(s);
    Log("Told you it doesn't!");
    //  This does:
    for (i = 0; i < 2; i += 1)
    {
        ModStruct(s);
        //  This also wouldn't lead to crash:
        //  s = ModStruct(s);
    }
    Log("I tried!");
}

defaultproperties
{
    //  Mutator description
    GroupName       = "Crash mutator"
    FriendlyName    = "Crash mutator"
    Description     = "Mutator to make your shjit crash"
}