Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ANDROID] NullPointerException on MotionEvent.getX() #9432

Closed
sddamico opened this issue Jul 6, 2017 · 2 comments
Closed

[ANDROID] NullPointerException on MotionEvent.getX() #9432

sddamico opened this issue Jul 6, 2017 · 2 comments
Assignees
Labels
Android Mapbox Maps SDK for Android

Comments

@sddamico
Copy link

sddamico commented Jul 6, 2017

Platform: Android
Mapbox SDK version: 5.0.2

I haven't been able to reproduce this crash myself, but I've seen it pop up a couple of times on my crashlytics dashboard:

http://crashes.to/s/d6acdd3e9ed

Full stack:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'float android.view.MotionEvent.getX()' on a null object reference
       at com.mapbox.mapboxsdk.maps.MapGestureDetector$GestureListener.onScroll(MapGestureDetector.java:381)
       at android.view.GestureDetector.onTouchEvent(GestureDetector.java:634)
       at android.support.v4.view.GestureDetectorCompat$GestureDetectorCompatImplJellybeanMr2.onTouchEvent(GestureDetectorCompat.java:480)
       at android.support.v4.view.GestureDetectorCompat.onTouchEvent(GestureDetectorCompat.java:543)
       at com.mapbox.mapboxsdk.maps.MapGestureDetector.onTouchEvent(MapGestureDetector.java:202)
       at com.mapbox.mapboxsdk.maps.MapView.onTouchEvent(MapView.java:296)
       at android.view.View.dispatchTouchEvent(View.java:10779)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2859)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2535)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
       at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:607)
       at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1890)
       at android.app.Activity.dispatchTouchEvent(Activity.java:3240)
       at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
       at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
       at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:569)
       at android.view.View.dispatchPointerEvent(View.java:11008)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5162)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5014)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4539)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4592)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4558)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4691)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4566)
       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4748)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4539)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4592)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4558)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4566)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4539)
       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7098)
       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7030)
       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6991)
       at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7208)
       at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
       at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
       at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
       at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:7172)
       at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:7235)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:959)
       at android.view.Choreographer.doCallbacks(Choreographer.java:734)
       at android.view.Choreographer.doFrame(Choreographer.java:664)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:945)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6776)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
@tobrun
Copy link
Member

tobrun commented Jul 6, 2017

One would assume the framework would return valid motion events but that assumption can differ between Android versions and different OEM implementations. Thank you for the report!

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Jul 6, 2017
@tobrun
Copy link
Member

tobrun commented Jul 6, 2017

Added a null check in #9434

@tobrun tobrun self-assigned this Jul 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

2 participants