airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native
http://airbnb.io/lottie/
Apache License 2.0
34.92k stars 5.4k forks source link

NullPointer crash problem #2483

Closed yunlinos closed 4 months ago

yunlinos commented 5 months ago

Hello, my app crashed suddenly, and i need your help.

The crash rate is extremely low and I can't pinpoint the exact time it occurs. However, this issue has affected 9 users, with one user experiencing the crash 9000 times.

java.lang.NullPointerException: Attempt to invoke interface method 'float android.view.animation.Interpolator.getInterpolation(float)' on a null object reference
at com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.getInterpolatedCurrentKeyframeProgress(BaseKeyframeAnimation.java:110)
at com.airbnb.lottie.animation.keyframe.FloatKeyframeAnimation.getFloatValue(FloatKeyframeAnimation.java:43)
at com.airbnb.lottie.model.layer.BaseLayer.lambda$setupInOutAnimations$0(BaseLayer.java:185)
at com.airbnb.lottie.model.layer.BaseLayer.lambda$setupInOutAnimations$0$BaseLayer
at com.airbnb.lottie.model.layer.-$$Lambda$BaseLayer$4LxogRHfsgkEfWkfLvNOorPl2m0.onValueChanged
at com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.notifyListeners(BaseKeyframeAnimation.java:69)
at com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.setProgress(BaseKeyframeAnimation.java:63)
at com.airbnb.lottie.model.layer.BaseLayer.setProgress(BaseLayer.java:582)
at com.airbnb.lottie.model.layer.CompositionLayer.setProgress(CompositionLayer.java:163)
at com.airbnb.lottie.LottieDrawable$1.onAnimationUpdate(LottieDrawable.java:94)
at com.airbnb.lottie.utils.BaseLottieAnimator.notifyUpdate(BaseLottieAnimator.java:99)
at com.airbnb.lottie.utils.LottieValueAnimator.doFrame(LottieValueAnimator.java:107)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:965)
at android.view.Choreographer.doCallbacks(Choreographer.java:791)
at android.view.Choreographer.doFrame(Choreographer.java:722)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)

What version of Lottie did you test this on? 6.3.0 What version of Android did you test this on? Android 10, API 29

I found a similar issue on Github (https://github.com/airbnb/lottie-android/issues/2050) and I suspect that the crash might be due to keyframe.interpolator being null. I would like to know if it is necessary to add null checks before using keyframe.interpolator to prevent this issue.

Looking forward to your reply, thank you!