RimworldMods
RimworldMods copied to clipboard
Modify list while looping
I encountered an error in RuinedEggs.cs
Bascially, it calls thing.AllComps.Remove(__instance); thing.AllComps.Remove(item);
in DoTicks
. The code is triggered in the following snippet
// in ThingWithComps.Tick
int i = 0;
for (int count = comps.Count; i < count; i++)
{
comps[i].CompTick();
}
So .comps
are modified while in a loop, hence indexOutOfRange
error