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
134 stars 171 forks source link

Maintenance error on customized vehicle in 48.0 campaign #2703

Closed SuperStucco closed 3 years ago

SuperStucco commented 3 years ago

In the attached 48.0 campaign, a customized MRM carrier is throwing errors during maintenance.

The log file has multiple instances of this:

21:14:11,035 ERROR [mekhq.campaign.Campaign] {AWT-EventQueue-0} doMaintenance(), line 6381 : Could not perform maintenance on part Unknown (0) for MRM Carrier (WoB 40) (d869d342-d1e9-44a7-84ab-e63a1ee4c5f8) due to an error java.lang.NullPointerException at mekhq.campaign.parts.Part.getQualityName(Part.java:257) at mekhq.campaign.Campaign.doMaintenanceOnUnitPart(Campaign.java:6446) at mekhq.campaign.Campaign.doMaintenance(Campaign.java:6376) at mekhq.campaign.Campaign.processNewDayUnits(Campaign.java:3274) at mekhq.campaign.Campaign.newDay(Campaign.java:3432) at mekhq.campaign.CampaignController.advanceDay(CampaignController.java:82) at mekhq.gui.CampaignGUI.lambda$initTopButtons$32(CampaignGUI.java:1053) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279) at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6635) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342) at java.desktop/java.awt.Component.processEvent(Component.java:6400) at java.desktop/java.awt.Container.processEvent(Container.java:2263) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

megameklog.txt Blake's Justice30700916.cpnx.gz

Customized vehicle (BLK attached as TXT extension): MRM Carrier (WoB 40).txt

sixlettervariables commented 3 years ago

Your part on a unit either doesn't have a Campaign or the campaign lacks CampaignOptions. Now that's just plain odd:

    public String getQualityName() {
        return getQualityName(getQuality(), campaign.getCampaignOptions().reverseQualityNames());
    }
sixlettervariables commented 3 years ago

To fully debug this I'll need the rest of your customs: image

sixlettervariables commented 3 years ago

I was unable to reproduce this on 0.49-dev after removing all the customs besides that MRM Carrier.

SuperStucco commented 3 years ago

Here's the customs (the engineering and infantry packs have a lot more to them, it's just easier to add them by folder rather than picking and choosing):

Maintenance error customs.zip

The issue occurred immediately after the refit, so it may be a one-off from that. Or it could be handled by changes in the 0.49 series.

sixlettervariables commented 3 years ago

That's a good bit of info, thanks!

sixlettervariables commented 3 years ago

I can't reproduce this, so if you have more detailed steps or if you can reproduce it reliably that would help!

I've got a bandaid I can apply as sort of a "just a guess" defense, but I'm not sure what the proximate cause of your error was.

SuperStucco commented 3 years ago

I haven't been able to reproduce this, so it's likely a one-off. Since the modification adds C3I it might be related to this: https://github.com/MegaMek/mekhq/issues/2647#issue-903151043. Like the Mech C3I wasn't in the equipment list, I had to use the "Show Unavailable" toggle and double-click the greyed out item to add it.

sixlettervariables commented 3 years ago

That's a possibility. I played around and wasn't able to induce that either. I'll close this with #2704, but if you see this again feel free to re-open this.

sixlettervariables commented 3 years ago

Closed by #2704