Assert LottieDrawable when recycling bitmaps
recycleBitmaps gets called from the super constructor of LottieAnimationView when a drawable is set from xml and causes a crash.
@@ -192,8 +192,12 @@ public class LottieAnimationView extends AppCompatImageView {
}
@VisibleForTesting void recycleBitmaps() {
+ // AppCompatImageView constructor will set the image when set from xml
+ // before LottieDrawable has been initialized
+ if (lottieDrawable != null) {
lottieDrawable.recycleBitmaps();
}
+ }
/**
* Enable this to get merge path support for devices running KitKat (19) and above.
