Konfetti icon indicating copy to clipboard operation
Konfetti copied to clipboard

API 21/22 crash during onVisibilityChanged

Open ouchadam opened this issue 2 years ago • 1 comments

When running konfetti-xml : 2.0.2 on API 21/22 (could also include lower version but haven't tested) the View lifecycle causes a crash. It looks like the constructor is directly calling into onVisibilityChanged causing a NPE as the fields are not yet initialised

Caused by: java.lang.NullPointerException: 
  at nl.dionsegijn.konfetti.xml.KonfettiView.onVisibilityChanged (KonfettiView.kt:3)
  at android.view.View.dispatchVisibilityChanged (View.java:9306)
  at android.view.View.setFlags (View.java:10737)
  at android.view.View.<init> (View.java:4410)
  at android.view.View.<init> (View.java:3891)
  at android.view.View.<init> (View.java:3870)
  at nl.dionsegijn.konfetti.xml.KonfettiView.<init> (KonfettiView.kt:1)

ouchadam avatar May 04 '22 08:05 ouchadam

Thanks for reporting the issue @ouchadam, I'll have to make some time to dive further into this issue. Feel free to clone the project and submit a PR if you already know how to solve the issue and then I'll review the code.

DanielMartinus avatar Jun 23 '23 10:06 DanielMartinus