MegaMek / megamek

MegaMek is a networked Java clone of BattleTech, a turn-based sci-fi boardgame for 2+ players. Fight using giant robots, tanks, and/or infantry on a hex-based map.
http://www.megamek.org
GNU General Public License v2.0
288 stars 278 forks source link

Null Pointer Exception #5502

Closed Logajam closed 2 months ago

Logajam commented 2 months ago

Environment

49.19

Description

nullpointer exception.

Created a custom unit. Testing to see what happens with infantry weapons on small support vehicles. Used a wasp as target practice. The game broke. See attached files.

Incidentally github doesn't like .blk files.

Files

megamek.log Test Drone Swarm.zip autosave.sav.gz

Sleet01 commented 2 months ago

Quick question, are you using the Milestone release (should say "0.49.19.1" in logs) or the pre-Milestone 0.49.19 release? There are a number of bug fixes in the former that might get around this issue... although to be honest, we are unlikely to support manually-created units.

Edit: from the log I see it's the latter, "v0.49.19". On the other hand, it looks like this code didn't change in 0.49.19.1 either, so this may be an extant bug.

gsparks3 commented 2 months ago

Infantry weapons on small support vehicles (the sub-5-ton ones built in kg scale) are valid under the existing rules, and should therefore get support. I wonder if this is another one of those "CI ammo"-related bugs?

Sleet01 commented 2 months ago

Infantry weapons on small support vehicles (the sub-5-ton ones built in kg scale) are valid under the existing rules, and should therefore get support. I wonder if this is another one of those "CI ammo"-related bugs?

Ah, I see. I read that as a manual edit, but you're right, it's supported in MML. It likely is related to how CI weapons have "ammo" but not Ammo; the Exception in the logs is just our code trying to get the linked Ammo Equipment and getting a null instead.