From 1279b23f620503356e4034ddb03317fbc31cdf66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Thu, 8 Aug 2013 21:19:06 +0200 Subject: [PATCH] check null because Nullable object must have a value fixes #3642 --- OpenRA.Mods.RA/AI/HackyAI.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/AI/HackyAI.cs b/OpenRA.Mods.RA/AI/HackyAI.cs index c0201ce051..7437b08734 100644 --- a/OpenRA.Mods.RA/AI/HackyAI.cs +++ b/OpenRA.Mods.RA/AI/HackyAI.cs @@ -652,7 +652,9 @@ namespace OpenRA.Mods.RA.AI if (owner.IsEmpty) return; if (!owner.TargetIsValid) { - owner.Target = owner.bot.FindClosestEnemy(AverageUnitsPosition(owner.units).Value.CenterPosition, WRange.FromCells(8)); + var circaPostion = AverageUnitsPosition(owner.units); + if (circaPostion == null) return; + owner.Target = owner.bot.FindClosestEnemy(circaPostion.Value.CenterPosition, WRange.FromCells(8)); if (owner.Target == null) {