okaybroda / ImageZoom

An Android library that makes any view to be zoomable.
GNU General Public License v3.0
120 stars 25 forks source link

Null pointer exception on animation update #6

Closed josuer closed 7 years ago

josuer commented 7 years ago

Hello, I found this issue on various devices, it mostly happens in Samsung devices, any idea how to fix it?

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setScaleX(float)' on a null object reference at com.viven.imagezoom.ImageZoomHelper$2.onAnimationUpdate(ImageZoomHelper.java:213) at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1463) at android.animation.ValueAnimator.animationFrame(ValueAnimator.java:1384) at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1427) at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:759) at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:686) at android.view.Choreographer.doFrame(Choreographer.java:619) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7325) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Seems likes when we reach the onAnimationUpdate in ImageZoomHelper(line 162) the zoomableView is null, any idea why this happends?

If we add a this.zoomableView != null in that method do you think it will be fixed?

Any help I'll be grateful.

okaybroda commented 7 years ago

Added null checks. Will be included in the next release.