Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FlyAttack invalid target crash. #17689

Merged
merged 1 commit into from Feb 20, 2020
Merged

Conversation

@pchote
Copy link
Member

pchote commented Feb 15, 2020

Fixes #17688.

Testcase:

diff --git a/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs b/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs
index 67ab3cf86b..f7907a2ac6 100644
--- a/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs
+++ b/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs
@@ -167,7 +167,10 @@ public override bool Tick(Actor self)
                        else if (attackAircraft.Info.AttackType == AirAttackType.Strafe)
                                QueueChild(new StrafeAttackRun(self, attackAircraft, target, strafeDistance != WDist.Zero ? strafeDistance : lastVisibleMaximumRange));
                        else if (attackAircraft.Info.AttackType == AirAttackType.Default && !aircraft.Info.CanHover)
+                       {
+                               target.Actor.Kill(self);
                                QueueChild(new FlyAttackRun(self, target, lastVisibleMaximumRange));
+                       }
 
                        // Turn to face the target if required.
                        else if (!attackAircraft.TargetInFiringArc(self, target, attackAircraft.Info.FacingTolerance))
@pchote pchote added this to the Next Release milestone Feb 15, 2020
@@ -222,8 +222,14 @@ public FlyAttackRun(Actor self, Target t, WDist exitRange)

protected override void OnFirstRun(Actor self)
{
QueueChild(new Fly(self, target, target.CenterPosition));
QueueChild(new Fly(self, target, exitRange, WDist.MaxValue, target.CenterPosition));
// The target may have died while this activity was queued

This comment has been minimized.

Copy link
@atlimit8

atlimit8 Feb 20, 2020

Member

Actually,

Suggested change
// The target may have died while this activity was queued
// The target may have died or changed targetability while this activity was queued

However, that is not worth blocking this.

@@ -261,8 +267,14 @@ public StrafeAttackRun(Actor self, AttackAircraft attackAircraft, Target t, WDis

protected override void OnFirstRun(Actor self)
{
QueueChild(new Fly(self, target, target.CenterPosition));
QueueChild(new Fly(self, target, exitRange, WDist.MaxValue, target.CenterPosition));
// The target may have died while this activity was queued

This comment has been minimized.

Copy link
@atlimit8

atlimit8 Feb 20, 2020

Member

Same as above:

Suggested change
// The target may have died while this activity was queued
// The target may have died or changed targetability while this activity was queued
@atlimit8 atlimit8 merged commit 7e72cd2 into OpenRA:bleed Feb 20, 2020
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.