check null because Nullable object must have a value

fixes #3642
This commit is contained in:
Matthias Mailänder
2013-08-08 21:19:06 +02:00
parent 6803414b22
commit 1279b23f62

View File

@@ -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)
{