From 6bbef8d33f0d1f71c9a22f36ddf95fa54ca5bd76 Mon Sep 17 00:00:00 2001 From: Scott_NZ Date: Wed, 13 Mar 2013 11:14:45 +1300 Subject: [PATCH] Fix crash in CaptureActor.Tick when trying to capture a dead actor --- OpenRA.Mods.RA/Activities/CaptureActor.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.RA/Activities/CaptureActor.cs b/OpenRA.Mods.RA/Activities/CaptureActor.cs index aa5d910a95..5a3c1f04e6 100644 --- a/OpenRA.Mods.RA/Activities/CaptureActor.cs +++ b/OpenRA.Mods.RA/Activities/CaptureActor.cs @@ -22,10 +22,6 @@ namespace OpenRA.Mods.RA.Activities public override Activity Tick(Actor self) { - var capturesInfo = self.Info.Traits.Get(); - var health = target.Trait(); - int damage = (int)(0.25 * health.MaxHP); - if (IsCanceled) return NextActivity; if (target == null || !target.IsInWorld || target.IsDead()) @@ -33,6 +29,10 @@ namespace OpenRA.Mods.RA.Activities if (target.Owner == self.Owner) return NextActivity; + var capturesInfo = self.Info.Traits.Get(); + var health = target.Trait(); + int damage = (int)(0.25 * health.MaxHP); + // Need to be next to building, TODO: stop capture when going away var mobile = self.Trait(); var nearest = target.OccupiesSpace.NearestCellTo(mobile.toCell);