Skip to content
This repository has been archived by the owner on Jul 10, 2018. It is now read-only.

NullPointerException in RootPaneDefaultButtonTracker #44

Closed
enwired opened this issue Oct 17, 2017 · 2 comments
Closed

NullPointerException in RootPaneDefaultButtonTracker #44

enwired opened this issue Oct 17, 2017 · 2 comments

Comments

@enwired
Copy link

enwired commented Oct 17, 2017

There is a possibility of a rare NullPointerException in RootPaneDefaultButtonTracker caused by what seems to me a simple logic error.

Basically, these two lines in RootPaneDefaultButtonTracker should be reversed:

tracker.startTimer();
trackers.put(jButton, tracker);

You should not start the timer loop before the tracker has been associated with the button in the map. Otherwise, this later code can produce a NullPointerException:

RootPaneDefaultButtonTracker tracker = trackers.get(jButton);
tracker.stopTimer();

An alternative fix is to put a check for tracker==null before calling tracker.stopTimer()

The bug is very, very rare, but I have seen it happen. I found and fixed this issue on a forked version:
Insubstantial#137

A stack trace is included there. The root cause still exists in Substance 7.1.

@kirill-grouchnikov
Copy link
Owner

Thanks Ed. I've added the fix locally. Will wait a couple more days to see if there's anything else that would be worth putting into a 7.1.01 respin and then push the update.

@enwired
Copy link
Author

enwired commented Oct 18, 2017

Thanks. And I'm in no rush. My project using Substance 7 won't have another release for 6 months or more.

kirill-grouchnikov added a commit that referenced this issue Oct 20, 2017
Fix for #44
Small tweaks in the test app
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants