From b8fd4abc4ac9a8913d8e031f5032509ffe2bd994 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 6 May 2018 16:26:02 +0100 Subject: [PATCH] Fix NRE in Guard when the target actor is dead. --- OpenRA.Mods.Common/Traits/Guard.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Guard.cs b/OpenRA.Mods.Common/Traits/Guard.cs index 72ce152914..37141f1e27 100644 --- a/OpenRA.Mods.Common/Traits/Guard.cs +++ b/OpenRA.Mods.Common/Traits/Guard.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "Guard") - GuardTarget(self, Target.FromActor(order.TargetActor), order.Queued); + GuardTarget(self, order.Target, order.Queued); } public void GuardTarget(Actor self, Target target, bool queued = false) @@ -49,6 +49,9 @@ namespace OpenRA.Mods.Common.Traits if (!queued) self.CancelActivity(); + if (target.Type != TargetType.Actor) + return; + self.SetTargetLine(target, Color.Yellow); var range = target.Actor.Info.TraitInfo().Range;