Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@SJuliez
Copy link
Member

@SJuliez SJuliez commented May 27, 2024

Fixes #5503

I think there must be more going on here. Bay shots don't quite seem to care about ammo, at least before the shot is actually taken. But this PR will at least fix the NPE from the report and allow the game to continue. Firing with the Arrow IV bay with the from the issue will correctly redice the ammo count by 12 for each shot (of 12 weapons).

r.newlines = 0;
r.subject = subjectId;
r.add(wtype.getName() + " (" + atype.getShortName() + ")");
r.add(wtype.getName() + (atype != null ? " (" + atype.getShortName() + ")" : ""));

Check warning

Code scanning / CodeQL

Dereferenced variable may be null

Variable [wtype](1) may be null at this access as suggested by [this](2) null guard.
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.

LGTM!

@SJuliez SJuliez merged commit e158822 into MegaMek:master May 29, 2024
@SJuliez SJuliez deleted the ds-with-arrow4-npe branch June 2, 2024 15:38
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.

A Different Null Pointer exception

2 participants