MegaMek / megameklab

MegaMekLab is a BattleTech unit modification program. It allows creating and modifying all unit types available in MegaMek from Support Vehicles up to WarShips. It also allows printing record sheets for single or multiple units.
http://www.megamek.org
86 stars 133 forks source link

Nightly: Dropship NPE - megamek.common.Aero.getEngine()" is null #1588

Closed repligator closed 2 months ago

repligator commented 3 months ago

Environment

Linux Java 17 MegaMekLab Nightly CI 1578

Description

Received the NPE when trying to preview or export a PDF of the attached BLK file.

Files

RMS Titanic Titanic.blk.zip megameklab.log

repligator commented 2 months ago

Different file, different version of MML, same NPE.

Environment

Linux Java 17 MML Code Revision: b1b0bee27fee84bfe1af4375aba9a5423258cea7

megameklab.log NPE Ship Prime.blk.tar.gz

Sleet01 commented 2 months ago

This is a weird one for a few reasons:

  1. I can't repro it on the latest code using the provided files,
  2. Large Aeros don't even show the Engine Type block in their record sheets so this is sort of wasted effort in the print code,
  3. It shouldn't be possible for an Aerospace unit of any kind to be valid without a set Engine, which we definitely check for.

Nevertheless, the NPE shows that it is possible to hit this state, and it is conceivable that the call to get a unit's engine entry might return a null value, so I'll safety this.

repligator commented 2 months ago

I normally run MM/MML/MHQ from IDEA, but I have some nightlies installed on an old Thinkpad. When I open the attached files on the computer I normally use, running the latest MML from IDEA, they work fine. But there haven't been any commits in time between the https://github.com/MegaMek/megameklab/commit/b1b0bee27fee84bfe1af4375aba9a5423258cea7 and the present version of MML. Is it possible something changed in MM?

Sleet01 commented 2 months ago

It's possible, yeah. The code MML is calling at the bottom of that stack of calls is actually in MegaMek. I'm just finishing up adding a unit test for this, then I'll try rolling the MM code back a bit and see if I can get a reliable repro with your files.