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

NPE: Cannot invoke "megamek.common.Mounted.getLinked()" because "weapon" is null #1429

Closed
HammerGS opened this issue Feb 17, 2024 · 6 comments · Fixed by MegaMek/megamek#5176
Assignees
Labels

Comments

@HammerGS
Copy link
Member

Environment

What version of MekLab does your issue apply to? 0.49.18
What operating system are you using? Windows Java 11

Description

Load a Aerospace fighter, and head to the equipment tab. NPE hits.

Files

13:59:31,936 ERROR [megameklab.MegaMekLab] {AWT-EventQueue-0}
megameklab.MegaMekLab.lambda$main$0(MegaMekLab.java:40) - Uncaught Exception Detected
java.lang.NullPointerException: Cannot invoke "megamek.common.Mounted.getLinked()" because "weapon" is null
	at megamek.common.WeaponType.getMaxRange(WeaponType.java:611)
	at megameklab.ui.util.EquipmentTableModel.getDamageString(EquipmentTableModel.java:471)
	at megameklab.ui.util.EquipmentTableModel.getValueAt(EquipmentTableModel.java:259)
	at java.desktop/javax.swing.JTable.getValueAt(JTable.java:2763)
	at java.desktop/javax.swing.JTable.prepareRenderer(JTable.java:5795)
	at java.desktop/javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2210)
	at java.desktop/javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:2112)
	at java.desktop/javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1908)
	at java.desktop/javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
	at java.desktop/javax.swing.JComponent.paintComponent(JComponent.java:842)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1119)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JViewport.paint(JViewport.java:736)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JSplitPane.paintChildren(JSplitPane.java:1030)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5311)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(RepaintManager.java:1657)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1632)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1570)
	at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1337)
	at java.desktop/javax.swing.JComponent._paintImmediately(JComponent.java:5259)
	at java.desktop/javax.swing.JComponent.paintImmediately(JComponent.java:5069)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:879)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:862)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:862)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:835)
	at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:784)
	at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1898)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	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)
@HammerGS HammerGS added the Bug label Feb 17, 2024
@Sleet01
Copy link
Collaborator

Sleet01 commented Feb 18, 2024

@HammerGS I'll take this one, although it looks like I can't assign it to myself in this project.

@Sleet01
Copy link
Collaborator

Sleet01 commented Feb 18, 2024

Note: this also hits MekHQ when refitting any Aerospace unit.

@metalconscript
Copy link

I am unsure how to apply the side fix. I'm not sure what is being described, please advise.

@MJM4444
Copy link

MJM4444 commented Mar 26, 2024

I have no Idea how to implement this fix, or even where to find it. Please advise.

@HammerGS
Copy link
Member Author

I have no Idea how to implement this fix, or even where to find it. Please advise.

This fix will be in the next release. Due in April.

This is simply the tracker showing fixed.

@gsparks3
Copy link
Collaborator

Alternately, you can download one of the nightly builds, which should include the fix, but may have other issues.

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

Successfully merging a pull request may close this issue.

5 participants