Fix crash in Beacon ctor when it runs during instead of between ticks
Causes an exception like below, for example when calling the Lua API's Beacon.New() method. ``Exception of type `System.InvalidOperationException`: Collection was modified; enumeration operation may not execute.``
This commit is contained in:
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Effects
|
||||
}
|
||||
|
||||
if (duration > 0)
|
||||
owner.World.Add(new DelayedAction(duration, () => owner.World.Remove(this)));
|
||||
owner.World.AddFrameEndTask(w => w.Add(new DelayedAction(duration, () => owner.World.Remove(this))));
|
||||
}
|
||||
|
||||
// Support power beacons are expected to clean themselves up
|
||||
|
||||
Reference in New Issue
Block a user