MegaMek / mekhq

MekHQ is a java helper program for the MegaMek game that allows users to load a list of entities from an XML file, perform repairs and customizations, and then save the new entities to another XML file that can be loaded into MegaMek.
http://megamek.org
130 stars 168 forks source link

Education NPE #4544

Closed repligator closed 1 month ago

repligator commented 1 month ago

Environment

Linux Java 17 https://github.com/MegaMek/mekhq/pull/4539

Description

mekhq.MekHQ.lambda$main$1(MekHQ.java:280) - Uncaught Exception Detected
java.lang.IllegalStateException: Unexpected value in mekhq/campaign/personnel/enums/education/EducationLevel.java/parseFromInt: -1
    at mekhq.campaign.personnel.enums.education.EducationLevel.parseFromInt(EducationLevel.java:118)

Swarm of education related NPE's. Might have something to do with the fact that I'm playing as WoB and sent quite a few personnel to be reeducated on Tharkard while it was contested between the Lyrans and WoB.

Files

mekhq.log Blakist Infantry30680704.cpnx.gz

IllianiCBT commented 1 month ago

Curious, it’s trying to parse an education level less than Early Education - and that’s why it’s throwing an error. Are you using a custom academy set and what academy are they being sent to?

repligator commented 1 month ago

Curious, it’s trying to parse an education level less than Early Education - and that’s why it’s throwing an error. Are you using a custom academy set and what academy are they being sent to?

No, everything is stock. Some of the personnel came from bulk hire, the others are from buying infantry in the personnel market. Is it possible to generate a person with less than early education?

I was playing as WoB, in 3068. At that point in time, (in MHQ) Tharkad is split between WoB and Lyrans. I arrived at Tharkad, and gave myself a planetary assault contract (issued by WoB targeting the Lyrans on Tharkad). Before the contract started, I sent 20+ soldiers to Tharkad for Reeducation. During the contract, I tried to send more, but they would inevitably be expelled due to war after 2-3 days. The 20+ I had sent earlier didn't seem to be having any issue.

repligator commented 1 month ago

Happened again on a different campaign. No war this time. No split planetary control either. Every single person was bulk gm hired as a dependent between the ages of 10 and 16.

mekhq.log OIF Testing30350604.cpnx.gz Autosave-1-OIF Testing-30350530.cpnx.gz

IllianiCBT commented 1 month ago

What kind of academy are you sending them to? And does the issue exist with the 16 year olds, as well as the <16 year olds? I'm starting to build a picture of what's going on.

repligator commented 1 month ago

It varies, about half were reeducation, there was also a bunch of students attending highschool. All local.

You mentioned earlier people being generated with an impossible education level. Below is a day 1 save with only 10 people, from 10 to 21. None of them have been sent anywhere yet. Is there a way to see if they have an impossible education level from looking at the save?

Education -130350101.cpnx.gz

I sent Mike Rüstü out for reeducation, GM completed it, and got the same NPE

IllianiCBT commented 1 month ago

So the 'impossible education' aspect was them graduating with an impossible education level, which tells me somewhere I am reducing education level's integer value below 0 (Early Education).

Tzahr commented 1 month ago

This might be related, I loaded up on the latest Nightly, and I had doctorate graduates appear with a "earned their Master degree" notficication instead. They'd be listed as doctorates in their highest edu, but not get the titular "Dr" either. I can file a seperate bug report if I spot it a second time.

IllianiCBT commented 1 month ago

Go ahead and file a report now, I know what's causing that and don't want to miss it.

IllianiCBT commented 1 month ago

Go ahead and file a report now, I know what's causing that and don't want to miss it.

I'm so glad my past self knew what the issue was, because my present self sure doesn't. Tell me your secrets Past Illiani! T_T

IllianiCBT commented 1 month ago

Would you be able to advise when the NPE occurs or, preferably, how to reproduce it?

IllianiCBT commented 1 month ago

Nevermind, found it

IllianiCBT commented 1 month ago

Closing as resolved