From c5684fcba5d753478942cd1dc1f07f5d1598d9f4 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 28 Feb 2011 20:35:09 +1300 Subject: [PATCH] fix crash on startup --- OpenRA.Mods.RA/Air/Plane.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.RA/Air/Plane.cs b/OpenRA.Mods.RA/Air/Plane.cs index 4c785871d9..d0ef7a79d5 100755 --- a/OpenRA.Mods.RA/Air/Plane.cs +++ b/OpenRA.Mods.RA/Air/Plane.cs @@ -42,11 +42,14 @@ namespace OpenRA.Mods.RA.Air { /* not spawning in the air, so try to assoc. with our afld. this is a hack. */ var afld = self.World.FindUnits(self.CenterLocation, self.CenterLocation) - .FirstOrDefault( a => a.HasTrait() ); - var res = afld.Trait(); - - if (res != null) - reservation = res.Reserve(afld, self); + .FirstOrDefault( a => a.HasTrait() ); + + if (afld != null) + { + var res = afld.Trait(); + if (res != null) + reservation = res.Reserve(afld, self); + } } } }