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 #4790: uncaught NPE when Sniper Turret fired on fleeing off-board target #4804

Conversation

Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Sep 25, 2023

Issue is that target is null by the time we get around to handling this indirect attack, because it has fled already.

Fix is to ignore this failure and just log the incident, as there doesn't seem to be any way to resolve damage from a missed counter-battery attack on an off-board target that has fled.

Tested by implementing this code in 0.49.14 and running OP's save file past the point that previously got hung.

close #4790

Copy link
Member

@NickAragua NickAragua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right idea, but can be done without a try/catch block.

@Sleet01 Sleet01 requested a review from NickAragua September 26, 2023 05:24
@NickAragua NickAragua merged commit b4030d0 into MegaMek:master Sep 27, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullPointerException at firing phase start
2 participants