Filter invalid actor IDs when restoring selection save data.
This commit is contained in:
@@ -229,7 +229,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (selectionNode != null)
|
if (selectionNode != null)
|
||||||
{
|
{
|
||||||
var selected = FieldLoader.GetValue<uint[]>("Selection", selectionNode.Value.Value)
|
var selected = FieldLoader.GetValue<uint[]>("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);
|
Combine(self.World, selected, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
foreach (var n in groupsNode.Value.Nodes)
|
foreach (var n in groupsNode.Value.Nodes)
|
||||||
{
|
{
|
||||||
var group = FieldLoader.GetValue<uint[]>(n.Key, n.Value.Value)
|
var group = FieldLoader.GetValue<uint[]>(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);
|
controlGroups[int.Parse(n.Key)].AddRange(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user