fix sub -> ground crash

This commit is contained in:
Chris Forbes
2010-08-06 20:11:49 +12:00
parent 1a428186e9
commit f64a6e273e

View File

@@ -248,10 +248,11 @@ namespace OpenRA.Mods.RA
{
var weapon = ChooseWeaponForTarget(Target.FromOrder(order));
self.QueueActivity(
new Activities.Attack(
Target.FromOrder(order),
Math.Max(0, (int)weapon.Info.Range)));
if (weapon != null)
self.QueueActivity(
new Activities.Attack(
Target.FromOrder(order),
Math.Max(0, (int)weapon.Info.Range)));
}
public bool HasAnyValidWeapons(Target t) { return Weapons.Any(w => w.IsValidAgainst(t)); }