Skip to content

Commit

Permalink
Fix a possible crash in DetonateWeaponPower
Browse files Browse the repository at this point in the history
  • Loading branch information
MustaphaTR committed Mar 24, 2024
1 parent 233aa77 commit 964c6fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions OpenRA.Mods.AS/Traits/SupportPowers/DetonateWeaponPower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public override void Activate(Actor self, Order order, SupportPowerManager manag
}

var targetPosition = order.Target.CenterPosition + new WVec(WDist.Zero, WDist.Zero, Info.AirburstAltitude);

self.World.AddFrameEndTask(w => w.Add(new DelayedAction(Info.ActivationDelay, () => self.World.AddFrameEndTask(w => Info.WeaponInfos.First(wi => wi.Key == GetLevel()).Value.Impact(Target.FromPos(targetPosition), self)))));
var weapon = Info.WeaponInfos.First(wi => wi.Key == GetLevel()).Value;
self.World.AddFrameEndTask(w => w.Add(new DelayedAction(Info.ActivationDelay, () => self.World.AddFrameEndTask(w => weapon.Impact(Target.FromPos(targetPosition), self)))));

if (Info.CameraRange != WDist.Zero)
{
Expand Down

0 comments on commit 964c6fb

Please sign in to comment.