fix crash with idle units and pathdebug

This commit is contained in:
Bob
2010-09-23 21:06:44 +12:00
parent 384b26db60
commit 66493031c8

View File

@@ -160,11 +160,12 @@ namespace OpenRA.Traits
{ {
if (!Game.world.LocalPlayer.PlayerActor.Trait<DeveloperMode>().PathDebug) return; if (!Game.world.LocalPlayer.PlayerActor.Trait<DeveloperMode>().PathDebug) return;
var activity = self.GetCurrentActivity();
var mobile = self.TraitOrDefault<IMove>(); var mobile = self.TraitOrDefault<IMove>();
if (mobile != null) if (activity != null && mobile != null)
{ {
var alt = new float2(0, -mobile.Altitude); var alt = new float2(0, -mobile.Altitude);
var path = self.GetCurrentActivity().GetCurrentPath(); var path = activity.GetCurrentPath();
var start = self.CenterLocation + alt; var start = self.CenterLocation + alt;
var c = Color.Green; var c = Color.Green;