From daa82d113ee2ed90d052849f9f379645bf9adf39 Mon Sep 17 00:00:00 2001 From: teinarss Date: Sat, 10 Aug 2019 09:02:25 +0200 Subject: [PATCH] Prevent crash when unloading Cargo structures --- OpenRA.Mods.Common/Activities/UnloadCargo.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Activities/UnloadCargo.cs b/OpenRA.Mods.Common/Activities/UnloadCargo.cs index cce65675ad..41fe74868c 100644 --- a/OpenRA.Mods.Common/Activities/UnloadCargo.cs +++ b/OpenRA.Mods.Common/Activities/UnloadCargo.cs @@ -25,6 +25,7 @@ namespace OpenRA.Mods.Common.Activities readonly INotifyUnload[] notifiers; readonly bool unloadAll; readonly Aircraft aircraft; + readonly Mobile mobile; readonly bool assignTargetOnFirstRun; readonly WDist unloadRange; @@ -44,6 +45,7 @@ namespace OpenRA.Mods.Common.Activities notifiers = self.TraitsImplementing().ToArray(); this.unloadAll = unloadAll; aircraft = self.TraitOrDefault(); + mobile = self.TraitOrDefault(); this.destination = destination; this.unloadRange = unloadRange; } @@ -80,7 +82,7 @@ namespace OpenRA.Mods.Common.Activities QueueChild(new Land(self, destination, unloadRange)); takeOffAfterUnload = !aircraft.AtLandAltitude; } - else + else if (mobile != null) { var cell = self.World.Map.Clamp(this.self.World.Map.CellContaining(destination.CenterPosition)); QueueChild(new Move(self, cell, unloadRange));