Merge pull request #3650 from Mailaender/hackyai-nre

Attempt to fix some rare exceptions in HackyAI
This commit is contained in:
Paul Chote
2013-08-12 03:01:11 -07:00

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