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 1588: NPE printing or previewing DropShip #1601

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Aug 27, 2024

Adds a safety check for the MML print code to prevent an NPE when an Aerospace unit's Engine isn't populated.
This shouldn't happen, and is nominally controlled by MM code, but if it does, there's no real reason not to populate the sheet:

  • DropShips don't even show the Engine info line,
  • ASFs do, but it's informational, not functional

Testing:

  • Ran checks with provided DS .blk files
  • Ran all 3 projects' unit tests
  • Added a unit test to confirm proper functionality in the above case.

Close #1588

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 2.14%. Comparing base (91bb560) to head (f81edf9).
Report is 134 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##             master   #1601      +/-   ##
===========================================
+ Coverage      0.65%   2.14%   +1.48%     
- Complexity       64     203     +139     
===========================================
  Files           266     266              
  Lines         30545   30547       +2     
  Branches       5206    5207       +1     
===========================================
+ Hits            201     656     +455     
+ Misses        30304   29737     -567     
- Partials         40     154     +114     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@repligator
Copy link
Collaborator

Did a bit of testing this morning with the latest MM/MML. You can reliably reproduce the NPE from #1588 by going to new Warship, changing the Vessel Type to Subcompact Warship, going to preview, and pressing Record Sheet.

When I tested under this PR, the NPE is no longer thrown when repeating the above steps.

@IllianiCBT IllianiCBT merged commit cc54a72 into MegaMek:master Aug 28, 2024
5 checks passed
@repligator repligator added the Record Sheets Record Sheets and PDF/Printing issue label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Record Sheets Record Sheets and PDF/Printing issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nightly: Dropship NPE - megamek.common.Aero.getEngine()" is null
3 participants