triplea-game / triplea

TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.
https://triplea-game.org/
GNU General Public License v3.0
1.33k stars 392 forks source link

UnitSeparator#getComparatorUnitCategories:129 - java.lang.NullPointerException #12868

Open tripleabuilderbot opened 3 weeks ago

tripleabuilderbot commented 3 weeks ago

User Description

I was playing triplea, updated to the newest version. I was playing the ww1 version and i tried to use a battle calculator. It gives me an error saying i dont have a null point. I dont know if its something to do with the map, or the current version of triplea. I know im in a testing stage for the new version., so i expect bugs, Im not complaining. Anyway have a nice day!

Map

world_war_i_1914 / World War I 1914

TripleA Version

2.7.14866

Java Version

11.0.19

Operating System

Windows 11

Heap Size

4046M

Stack Trace

Exception: java.lang.NullPointerException 
java.lang.Exception
    at games.strategy.triplea.util.UnitSeparator.getComparatorUnitCategories(UnitSeparator.java:129)
    at games.strategy.triplea.util.UnitSeparator.sortUnitCategories(UnitSeparator.java:114)
    at games.strategy.triplea.odds.calculator.PlayerUnitsPanel.init(PlayerUnitsPanel.java:85)
    at games.strategy.triplea.odds.calculator.BattleCalculatorPanel.setAttackingUnits(BattleCalculatorPanel.java:699)
    at games.strategy.triplea.odds.calculator.BattleCalculatorPanel.lambda$new$1(BattleCalculatorPanel.java:378)
    at java.desktop/javax.swing.JComboBox.fireActionEvent(JComboBox.java:1264)
    at java.desktop/javax.swing.JComboBox.setSelectedItem(JComboBox.java:589)
    at games.strategy.triplea.odds.calculator.BattleCalculatorPanel.setAttacker(BattleCalculatorPanel.java:518)
    at java.base/java.util.Optional.ifPresent(Optional.java:183)
    at games.strategy.triplea.odds.calculator.BattleCalculatorPanel.setupAttackerAndDefender(BattleCalculatorPanel.java:507)
    at games.strategy.triplea.odds.calculator.BattleCalculatorPanel.<init>(BattleCalculatorPanel.java:473)
    at games.strategy.triplea.odds.calculator.BattleCalculatorDialog.show(BattleCalculatorDialog.java:55)
    at games.strategy.triplea.ui.menubar.GameMenu.lambda$new$1(GameMenu.java:83)
    at org.triplea.swing.SwingAction$1.actionPerformed(SwingAction.java:60)
    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.AbstractButton.doClick(AbstractButton.java:369)
    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020)
    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1064)
    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)
asvitkine commented 3 weeks ago

Might be related to https://github.com/triplea-game/triplea/pull/12783, since it changed the code in question.

frigoref commented 2 days ago

We would need a save game from the author. Linked to issue 12897 with same title.