Skip to content

Commit

Permalink
fixed #1101 Exception when closing Snackbar while a event is still ac…
Browse files Browse the repository at this point in the history
…tive
  • Loading branch information
Shadi Shaheen committed Jun 17, 2020
1 parent e1f40e9 commit 353dccf
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions jfoenix/src/main/java/com/jfoenix/controls/JFXSnackbar.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,15 @@ private Timeline getTimeline(Duration timeout) {
pauseTransition = Duration.INDEFINITE.equals(timeout) ? null : new PauseTransition(timeout);
if (pauseTransition != null) {
animation.setOnFinished(finish -> {
pauseTransition.setOnFinished(done -> {
pauseTransition = null;
eventsSet.remove(currentEvent);
currentEvent = eventQueue.peek();
close();
});
pauseTransition.play();
if (pauseTransition != null) {
pauseTransition.setOnFinished(done -> {
pauseTransition = null;
eventsSet.remove(currentEvent);
currentEvent = eventQueue.peek();
close();
});
pauseTransition.play();
}
});
}
return animation;
Expand All @@ -261,6 +263,10 @@ public void close() {
openAnimation.stop();
}
if (this.isVisible()) {
if (pauseTransition != null) {
pauseTransition.stop();
pauseTransition = null;
}
Timeline closeAnimation = new Timeline(
new KeyFrame(
Duration.ZERO,
Expand Down

0 comments on commit 353dccf

Please sign in to comment.