Fix NRE in Guard when the target actor is dead.
This commit is contained in:
@@ -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<GuardableInfo>().Range;
|
||||
|
||||
Reference in New Issue
Block a user