Skip to content

NPE: Cannot invoke "java.awt.Component.repaint()" because "this.repaintComponent" is null at ListingMiddleMouseHighlightProvider.setHighlightString #8798

@bthiae2934

Description

@bthiae2934

Describe the bug
An exception throws when clicking a register in Function Graph with setting Cursor Text Highlight's mouse button set to "left".

To Reproduce
Steps to reproduce the behavior:

  1. Load anything in CodeBrowser
  2. Edit -> Tool Options, Listing Fields -> Cursor Text Highlight, set mouse button to "LEFT".
  3. Navigate to any function and click "Display Function Graph" icon on toolbar.
  4. Click a register.
  5. Following exception threw:
Cannot invoke "java.awt.Component.repaint()" because "this.repaintComponent" is null
java.lang.NullPointerException: Cannot invoke "java.awt.Component.repaint()" because "this.repaintComponent" is null
	at ghidra.app.plugin.core.codebrowser.ListingMiddleMouseHighlightProvider.clearHighlight(ListingMiddleMouseHighlightProvider.java:216)
	at ghidra.app.plugin.core.codebrowser.ListingMiddleMouseHighlightProvider.setHighlightString(ListingMiddleMouseHighlightProvider.java:204)
	at ghidra.app.plugin.core.codebrowser.ListingMiddleMouseHighlightProvider.buttonPressed(ListingMiddleMouseHighlightProvider.java:195)
	at ghidra.app.plugin.core.functiongraph.mvc.FGController$FgHighlightProvider.buttonPressed(FGController.java:1174)
	at ghidra.app.util.viewer.listingpanel.ListingPanel.buttonPressed(ListingPanel.java:833)
	at docking.widgets.fieldpanel.FieldPanel.lambda$notifyFieldMouseListeners$1(FieldPanel.java:1359)
	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:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	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)

---------------------------------------------------
Build Date: 2025-Dec-05 1355 EST
Ghidra Version: 12.0
Java Home: C:\Program Files\Java\jdk-21
JVM Version: Oracle Corporation 21.0.9
OS: Windows 11 10.0 amd64
Workstation: DESKTOP-8SAV2DL

Expected behavior
There should be no NPE.

Screenshots
If applicable, add screenshots to help explain your problem.

Attachments
If applicable, please attach any files that caused problems or log files generated by the software.

Environment (please complete the following information):

  • OS: Windows 11
  • Java Version: 21.0.9
  • Ghidra Version: 12.0
  • Ghidra Origin: official GitHub distro

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Status: InternalThis is being tracked internally by the Ghidra team

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions