Guard the trait lookup.

This commit is contained in:
Matthias Mailänder
2024-08-30 19:19:39 +02:00
committed by Gustas
parent 25dd0508c2
commit 41f28f2519

View File

@@ -183,7 +183,7 @@ namespace OpenRA.Mods.Common.Traits
if (modifiers.HasModifier(TargetModifiers.ForceAttack) && !string.IsNullOrEmpty(info.ForceSetType))
{
var closest = self.World.Selection.Actors
.Where(a => a.TraitOrDefault<RallyPoint>()?.Info.ForceSetType == info.ForceSetType)
.Where(a => !a.IsDead && a.IsInWorld && a.TraitOrDefault<RallyPoint>()?.Info.ForceSetType == info.ForceSetType)
.ClosestToIgnoringPath(target.CenterPosition);
ForceSet = closest == self;