Fix invalid target crash in SupportPowerManager.Activate.

This commit is contained in:
Paul Chote
2019-03-09 17:54:13 +00:00
committed by reaperrr
parent 1a728ee153
commit 71dd84b9d5

View File

@@ -236,7 +236,7 @@ namespace OpenRA.Mods.Common.Traits
var power = Instances.Where(i => !i.IsTraitPaused && !i.IsTraitDisabled) var power = Instances.Where(i => !i.IsTraitPaused && !i.IsTraitDisabled)
.MinByOrDefault(a => .MinByOrDefault(a =>
{ {
if (a.Self.OccupiesSpace == null) if (a.Self.OccupiesSpace == null || order.Target.Type == TargetType.Invalid)
return 0; return 0;
return (a.Self.CenterPosition - order.Target.CenterPosition).HorizontalLengthSquared; return (a.Self.CenterPosition - order.Target.CenterPosition).HorizontalLengthSquared;