Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

NullPointerException in RootPaneDefaultButtonTracker #137

Open
enwired opened this issue Apr 1, 2015 · 0 comments
Open

NullPointerException in RootPaneDefaultButtonTracker #137

enwired opened this issue Apr 1, 2015 · 0 comments

Comments

@enwired
Copy link

enwired commented Apr 1, 2015

The following stack trace has been found in one of our applications using Insubstantial 7.3:

java.lang.NullPointerException
    at org.pushingpixels.substance.internal.animation.RootPaneDefaultButtonTracker.onTimelineEvent(RootPaneDefaultButtonTracker.java:173)
    at org.pushingpixels.substance.internal.animation.RootPaneDefaultButtonTracker.onTimelineStateChanged(RootPaneDefaultButtonTracker.java:147)
    at org.pushingpixels.trident.Timeline$Chain.onTimelineStateChanged(Timeline.java:214)
    at org.pushingpixels.trident.TimelineEngine$1.run(TimelineEngine.java:591)
    at org.pushingpixels.trident.TimelineEngine$TimelineCallbackThread.run(TimelineEngine.java:242)```


The error occurs here:
```java
            RootPaneDefaultButtonTracker tracker = trackers.get(jButton);
            tracker.stopTimer();

I suspect, but am not sure, that it is caused by this order of events:

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

The timer could start firing events prior to the tracker being put into the map.

I suggest to fix the problem by doing a check for null at the point of the observed error:

            RootPaneDefaultButtonTracker tracker = trackers.get(jButton);
      if (tracker != null) {
            tracker.stopTimer();
      }

and also reversing the later two lines to be:

            trackers.put(jButton, tracker);
            tracker.startTimer();
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

1 participant