From 66493031c86134279eb4d473ddb4fe611faae9cb Mon Sep 17 00:00:00 2001 From: Bob Date: Thu, 23 Sep 2010 21:06:44 +1200 Subject: [PATCH] fix crash with idle units and pathdebug --- OpenRA.Game/Traits/Selectable.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Traits/Selectable.cs b/OpenRA.Game/Traits/Selectable.cs index 96d3bc216a..6949d37d8f 100644 --- a/OpenRA.Game/Traits/Selectable.cs +++ b/OpenRA.Game/Traits/Selectable.cs @@ -159,12 +159,13 @@ namespace OpenRA.Traits void DrawUnitPath(Actor self) { if (!Game.world.LocalPlayer.PlayerActor.Trait().PathDebug) return; - + + var activity = self.GetCurrentActivity(); var mobile = self.TraitOrDefault(); - if (mobile != null) + if (activity != null && mobile != null) { var alt = new float2(0, -mobile.Altitude); - var path = self.GetCurrentActivity().GetCurrentPath(); + var path = activity.GetCurrentPath(); var start = self.CenterLocation + alt; var c = Color.Green;