Skip to content

Commit 4f51260

Browse files
committed
crash fix
1 parent 5f09a59 commit 4f51260

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

OpenRA.Mods.Common/Traits/AutoTarget.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ void INotifyDamage.Damaged(Actor self, AttackInfo e)
241241
if (oat.TryGetAutoTargetOverride(self, out _))
242242
return;
243243

244+
var owner = self.Owner;
245+
if (owner == null)
246+
return;
247+
244248
if (!attacker.IsInWorld)
245249
{
246250
// If the aggressor is in a transport, then attack the transport instead
@@ -250,7 +254,7 @@ void INotifyDamage.Damaged(Actor self, AttackInfo e)
250254
}
251255

252256
// Don't fire at an invisible enemy when we can't move to reveal it
253-
if (!AllowMove && !attacker.CanBeViewedByPlayer(self.Owner))
257+
if (!AllowMove && !attacker.CanBeViewedByPlayer(owner))
254258
return;
255259

256260
// Not a lot we can do about things we can't hurt... although maybe we should automatically run away?

0 commit comments

Comments
 (0)