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 null pointer when turning with shortcut keys in movement phase. #5351

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

HoneySkull
Copy link
Collaborator

Fixes #5350

During the movement phase that follows a previous firing phase - when using the short cut keys "Shift-A" or "Shift-D to turn left or right results in a null pointer exception in the FiringDisplay class when it is checking for torso twist left or right.

The expression was updated to promote the check for firing display visibility and ignore event status BEFORE checking the selected entity which can be null in the FiringDisplay during the movement phase.

This bug could also cause a null pointer when trying to turn other units - not just aerospace fighters like the bug report suggests.

Copy link
Collaborator

@Sleet01 Sleet01 left a comment

Choose a reason for hiding this comment

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

Looks good! I think I added the getAlreadyTwisted() functionality for the TAG-phase torso twisting, but I didn't realize it was possible for the entity to be null later on -_-;

@HammerGS HammerGS merged commit 310dbac into MegaMek:master Apr 12, 2024
4 checks passed
@HoneySkull HoneySkull deleted the NPE_on_turn_shortcut_movement branch April 18, 2024 04:22
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.

[0.49.19-SNAPSHOT #1461] NPE When turning Aerospace with Shift-D or Shift-A Shortcut keys in Movement Phase
3 participants