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

NullPointerException in RootPaneDefaultButtonTracker #137

@enwired

Description

@enwired

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions