confetti icon indicating copy to clipboard operation
confetti copied to clipboard

Fixed the crash on the terminate method

Open Brammos opened this issue 4 years ago • 0 comments

Hey,

I fixed the crash on the terminate method:

/**
   * Terminate the currently running animation if there is any.
   */
  public void terminate() {
      if (animator != null) {
          animator.cancel();
      }

      if (confettiView != null && confettiView.getParent() != null)
          confettiView.terminate();

      if (animationListener != null) {
          animationListener.onAnimationEnd(this);
      }
  }

The problem is when you initialize an ConfettiManager with confettiView null the terminate method will crash. This is easily avoidable by adding this extra check. I've tried making an PR for it but i can't seem to push on a separate branch getting error 403.

Btw this crash happens in Kotlin because you van initialize the ConfettiManager as Confettimanager(ConfettoGenerator,ConfettiSource,null,null) if you want.

Brammos avatar Apr 16 '20 10:04 Brammos