diff --git a/OpenRA.Mods.Common/Traits/World/Selection.cs b/OpenRA.Mods.Common/Traits/World/Selection.cs index 5e138d6077..b20afae768 100644 --- a/OpenRA.Mods.Common/Traits/World/Selection.cs +++ b/OpenRA.Mods.Common/Traits/World/Selection.cs @@ -229,7 +229,7 @@ namespace OpenRA.Mods.Common.Traits if (selectionNode != null) { var selected = FieldLoader.GetValue("Selection", selectionNode.Value.Value) - .Select(a => self.World.GetActorById(a)); + .Select(a => self.World.GetActorById(a)).Where(a => a != null); Combine(self.World, selected, false, false); } @@ -239,7 +239,7 @@ namespace OpenRA.Mods.Common.Traits foreach (var n in groupsNode.Value.Nodes) { var group = FieldLoader.GetValue(n.Key, n.Value.Value) - .Select(a => self.World.GetActorById(a)); + .Select(a => self.World.GetActorById(a)).Where(a => a != null); controlGroups[int.Parse(n.Key)].AddRange(group); } }