From 30e769386252b1b0e3a694b671ae162bc659a48f Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 5 Jan 2010 15:33:22 +1300 Subject: [PATCH] cargo: don't crash. --- OpenRa.Game/Traits/Cargo.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenRa.Game/Traits/Cargo.cs b/OpenRa.Game/Traits/Cargo.cs index 943fdcf8dd..3d1f27cea0 100644 --- a/OpenRa.Game/Traits/Cargo.cs +++ b/OpenRa.Game/Traits/Cargo.cs @@ -15,12 +15,14 @@ namespace OpenRa.Game.Traits public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor) { - var unit = underCursor.traits.GetOrDefault(); - if (unit.Altitude > 0) return null; - // todo: check if there is an unoccupied `land` tile adjacent if (mi.Button == MouseButton.Right && underCursor == self && cargo.Count > 0) + { + var unit = underCursor.traits.GetOrDefault(); + if (unit != null && unit.Altitude > 0) return null; + return new Order("Deploy", self, null, int2.Zero, null); + } return null; }