Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

NPE in addMovement #118

Open
gmk57 opened this issue Jul 16, 2019 · 1 comment
Open

NPE in addMovement #118

gmk57 opened this issue Jul 16, 2019 · 1 comment

Comments

@gmk57
Copy link

gmk57 commented Jul 16, 2019

We see in Crashlytics a rare exception on Samsung devices with Android 8 and 9:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.VelocityTracker.addMovement(android.view.MotionEvent)' on a null object reference
       at jp.co.recruit_lifestyle.android.floatingview.FloatingView.addMovement + 927(FloatingView.java:927)
       at jp.co.recruit_lifestyle.android.floatingview.FloatingView.dispatchTouchEvent + 859(FloatingView.java:859)
       at android.view.View.dispatchPointerEvent + 13719(View.java:13719)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent + 6111(ViewRootImpl.java:6111)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess + 5889(ViewRootImpl.java:5889)
       at android.view.ViewRootImpl$InputStage.deliver + 5338(ViewRootImpl.java:5338)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext + 5391(ViewRootImpl.java:5391)
       at android.view.ViewRootImpl$InputStage.forward + 5357(ViewRootImpl.java:5357)
       at android.view.ViewRootImpl$AsyncInputStage.forward + 5516(ViewRootImpl.java:5516)
       at android.view.ViewRootImpl$InputStage.apply + 5365(ViewRootImpl.java:5365)
       at android.view.ViewRootImpl$AsyncInputStage.apply + 5573(ViewRootImpl.java:5573)
       at android.view.ViewRootImpl$InputStage.deliver + 5338(ViewRootImpl.java:5338)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext + 5391(ViewRootImpl.java:5391)
       at android.view.ViewRootImpl$InputStage.forward + 5357(ViewRootImpl.java:5357)
       at android.view.ViewRootImpl$InputStage.apply + 5365(ViewRootImpl.java:5365)
       at android.view.ViewRootImpl$InputStage.deliver + 5338(ViewRootImpl.java:5338)
       at android.view.ViewRootImpl.deliverInputEvent + 8400(ViewRootImpl.java:8400)
       at android.view.ViewRootImpl.doProcessInputEvents + 8333(ViewRootImpl.java:8333)
       at android.view.ViewRootImpl.enqueueInputEvent + 8286(ViewRootImpl.java:8286)
       at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent + 8515(ViewRootImpl.java:8515)
       at android.view.InputEventReceiver.dispatchInputEvent + 198(InputEventReceiver.java:198)
       at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
       at android.view.InputEventReceiver.consumeBatchedInputEvents + 187(InputEventReceiver.java:187)
       at android.view.ViewRootImpl.doConsumeBatchedInput + 8474(ViewRootImpl.java:8474)
       at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run + 8542(ViewRootImpl.java:8542)
       at android.view.Choreographer$CallbackRecord.run + 949(Choreographer.java:949)
       at android.view.Choreographer.doCallbacks + 761(Choreographer.java:761)
       at android.view.Choreographer.doFrame + 690(Choreographer.java:690)
       at android.view.Choreographer$FrameDisplayEventReceiver.run + 935(Choreographer.java:935)
       at android.os.Handler.handleCallback + 873(Handler.java:873)
       at android.os.Handler.dispatchMessage + 99(Handler.java:99)
       at android.os.Looper.loop + 214(Looper.java:214)
       at android.app.ActivityThread.main + 7058(ActivityThread.java:7058)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 493(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main + 965(ZygoteInit.java:965)
@Jwillc
Copy link

Jwillc commented Feb 2, 2020

I've been having this issue for awhile. You think at 927 in FloatingView you could do:

if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker.addMovement(event); } else { mVelocityTracker.addMovement(event); }

Or pass a non-null VelocityTracker to addMovement()?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants