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

48.0 Changing "Jump Type" and/or MP on BA causes NPEs #935

Closed
gsparks3 opened this issue Jul 10, 2021 · 1 comment · Fixed by #952
Closed

48.0 Changing "Jump Type" and/or MP on BA causes NPEs #935

gsparks3 opened this issue Jul 10, 2021 · 1 comment · Fixed by #952

Comments

@gsparks3
Copy link
Collaborator

gsparks3 commented Jul 10, 2021

Environment

MML v48.0
Windows 10
OpenJDK 11.0.10

Reproduction steps:

  1. Open a "New Battle Armor" with default settings. Its Jump Jet type will be set to "None" by default (which is not actually one of the available options on the drop-down menu - I am uncertain if this is related, but it might be).
  2. Click the up-arrow on the Jump/VTOL/UMU MP spinner to increase Jump MP by one. As might be expected with "Jump Type: None", the MP listed remains at 0. However, this also immediately generates a (rather lengthy) NPE in the log file.
  3. Open the Jump Type drop-down and select "Jump Jet". The Base Jump MP will still be listed as 0, but the Final Jump MP will now be listed as 1.
  4. Click the up-arrow on the Jump MP spinner to increase Jump MP by one again. Both the Base and Final Jump MP will now be listed as 2. Using the spinner arrows to alter Jump MP in the range 1-3 will show no further issues.
  5. If using the spinner down-arrow to decrease Jump MP to 0, the Jump Type will return to None. No NPE will occur at this point, but repeating Step 2 at this point will repeat the initial NPE and display bug in Step 3.
  6. If you click the spinner up-arrow twice before changing the Jump Type away from None, two duplicate NPEs will appear in the logs, and when changing the Jump Jet Type to Jump Jet, the Final Jump MP will change to 2 rather than 1, with the Base Jump MP remaining at 0. Using either the spinner up-arrow or down-arrow at this point will cause the behavior to reset to normal and remain normal as long as you stay within the 1-3 Jump MP range. Similar results occur if you click the spinner up-arrow three times before changing the Jump Type, but then you have to use the down-arrow to get the Base Jump MP to properly update.

NPE from attempting to increase Jump MP with Jump Type-None:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at megamek.common.Mounted.<init>(Mounted.java:194)
	at megamek.common.Entity.addEquipment(Entity.java:3556)
	at megamek.common.Entity.addEquipment(Entity.java:3522)
	at megamek.common.Entity.addEquipment(Entity.java:3514)
	at megameklab.com.ui.BattleArmor.tabs.StructureTab.jumpTypeChanged(StructureTab.java:516)
	at megameklab.com.ui.BattleArmor.tabs.StructureTab.jumpChanged(StructureTab.java:501)
	at megameklab.com.ui.view.MovementView.lambda$stateChanged$4(MovementView.java:413)
	at java.base/java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:807)
	at megameklab.com.ui.view.MovementView.stateChanged(MovementView.java:413)
	at java.desktop/javax.swing.JSpinner.fireStateChanged(JSpinner.java:461)
	at java.desktop/javax.swing.JSpinner$ModelListener.stateChanged(JSpinner.java:388)
	at java.desktop/javax.swing.AbstractSpinnerModel.fireStateChanged(AbstractSpinnerModel.java:120)
	at java.desktop/javax.swing.SpinnerNumberModel.setValue(SpinnerNumberModel.java:460)
	at java.desktop/javax.swing.JSpinner.setValue(JSpinner.java:355)
	at java.desktop/javax.swing.plaf.basic.BasicSpinnerUI$ArrowButtonHandler.actionPerformed(BasicSpinnerUI.java:668)
	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.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)

I also had a bug that would cause MML to freak out when attempting to switch to the Assign Criticals panel in a similar situation, but I'm having trouble getting that one to reproduce on demand, so check this out first. Possibly this first NPE led to the later issue anyway.

@gsparks3
Copy link
Collaborator Author

Thought I'd add the NPE from the second bug mentioned above, since while I was not able to reproduce it I did save the log file:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at megamek.common.CriticalSlot.<init>(CriticalSlot.java:70)
	at megameklab.com.util.CritListCellRenderer.getListCellRendererComponent(CritListCellRenderer.java:68)
	at java.desktop/javax.swing.plaf.basic.BasicListUI.paintCell(BasicListUI.java:270)
	at java.desktop/javax.swing.plaf.basic.BasicListUI.paintImpl(BasicListUI.java:378)
	at java.desktop/javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:301)
	at java.desktop/javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
	at java.desktop/javax.swing.JComponent.paintComponent(JComponent.java:797)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1074)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JViewport.paint(JViewport.java:737)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5255)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(RepaintManager.java:1643)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1618)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1556)
	at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1323)
	at java.desktop/javax.swing.JComponent._paintImmediately(JComponent.java:5203)
	at java.desktop/javax.swing.JComponent.paintImmediately(JComponent.java:5013)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:865)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:848)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:848)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:823)
	at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:772)
	at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1890)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	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.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant