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

[0.49.15] Nightly - NPE When Assigning Scout Lance to Stratcon Map #3767

Closed
PhoenixHeart512 opened this issue Oct 9, 2023 · 4 comments · Fixed by #3994
Closed

[0.49.15] Nightly - NPE When Assigning Scout Lance to Stratcon Map #3767

PhoenixHeart512 opened this issue Oct 9, 2023 · 4 comments · Fixed by #3994
Assignees

Comments

@PhoenixHeart512
Copy link

Environment

(My mekHQ log appears malformed and is missing the initialization blurb, so this is pulled from megamek.log. Odd that it says megameklab instead of megamek, but the version information is still accurate.

megamek.MegaMek.initializeLogging(MegaMek.java:118) - Starting MegaMek v0.49.15-SNAPSHOT
Build Date: 2023-10-02T01:08:23.012828800
Today: 2023-10-09
Origin Project: MegaMekLab
Java Vendor: Eclipse Adoptium
Java Version: 17.0.6
Platform: Windows 10 10.0 (amd64)
System Locale: en_US
Total memory available to MegaMek: 4 GB

Description

When deploying Scythe lance (mechs, scout role) to hex 0203 on Track 0, I got an NPE popup. Save file attached, the "Tempest Marauders II.cpnx" manual save was done moments before deploying the lance to the hex.

12:33:26,010 ERROR [mekhq.MekHQ] {AWT-EventQueue-0}
mekhq.MekHQ.lambda$main$0(MekHQ.java:240) - Uncaught Exception Detected
java.lang.NullPointerException: Cannot invoke "megamek.common.options.IOption.setValue(boolean)" because the return value of "megamek.common.options.PilotOptions.getOption(String)" is null

Files

Zip file contents are matched to the file structure of a mekHQ installation and can be extracted on top of a fresh MekHQ installation to place all files in the correct associated paths.

I use the custom "heavy" scenariotemplates that I created, and I modified two of the scenariomodifier files to increase the weight class of enemy officer/commander mechs, in case those are causing this.

I'm also including the megamek.log file as it also looks ... odd, in case it has any useful information.

Stratcon Assignment NPE 10-9-2023.zip

@PhoenixHeart512
Copy link
Author

Upon loading the save and deploying the same lance to the same hex, no error occurred and a scenario popped up like normal. The error may be with a specific scenario type or modifier and may not occur unless that problematic one gets rolled for a new scenario.

@SuperStucco
Copy link

(My mekHQ log appears malformed and is missing the initialization blurb, so this is pulled from megamek.log. Odd that it says megameklab instead of megamek, but the version information is still accurate.

I notice this when I have MekHQ running then start up a separate session of MML.

@Sleet01
Copy link
Collaborator

Sleet01 commented Apr 14, 2024

The issue is that there's at least one SPA whose name in the XML (loaded by the Crew Upgrader code) doesn't match what's in MegaMek's PilotOptions.
The quick fix is to wrap the failing call in a Try/Catch block; the correct fix is to find the offending entry (or entries) and fix them.

I'mma do the quick fix first, then the correct fix if there's time.

@Sleet01
Copy link
Collaborator

Sleet01 commented Apr 14, 2024

I use the custom "heavy" scenariotemplates that I created, and I modified two of the scenariomodifier files to increase the weight class of enemy officer/commander mechs, in case those are causing this.

I think this likely raises the chances of hitting the issue, although doesn't make it guaranteed. There are a bunch of tech-related SPAs included in defaultspa.xml that don't exist in MegaMek, at least not as crew SPAs for combat units, and trying to apply these SPAs was causing the NullPointerException.

I've raised the issue with the data experts, but in the meantime I'm fixing the code to just keep trying SPAs until it finds a good one or runs out of options.

Sleet01 added a commit that referenced this issue Apr 15, 2024
Fix #3767: NPE while scouting if AtB tries to generate enemy with SPAs not found in MM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants