From 6f2d1c54d6fa2c988aa6a0a41f47504f5d70c46a Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 8 Jul 2011 22:13:24 +1200 Subject: [PATCH] fixed #983 -- don't crash in HackyAI if we can't find a target. --- OpenRA.Mods.RA/HackyAI.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.RA/HackyAI.cs b/OpenRA.Mods.RA/HackyAI.cs index 053ef55141..67a93359c1 100644 --- a/OpenRA.Mods.RA/HackyAI.cs +++ b/OpenRA.Mods.RA/HackyAI.cs @@ -283,13 +283,13 @@ namespace OpenRA.Mods.RA attackTarget = ChooseEnemyTarget(); if (attackTarget == null) return; + + foreach (var a in unitsHangingAroundTheBase) + if (TryToMove(a, attackTarget.Value, true)) + attackForce.Add(a); + + unitsHangingAroundTheBase.Clear(); } - - foreach (var a in unitsHangingAroundTheBase) - if (TryToMove(a, attackTarget.Value, true)) - attackForce.Add(a); - - unitsHangingAroundTheBase.Clear(); } // If we have any attackers, let them scan for enemy units and stop and regroup if they spot any