Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in TouchGestureHandler #1051

Closed
wojtek-abakus opened this issue Apr 16, 2018 · 2 comments
Closed

NPE in TouchGestureHandler #1051

wojtek-abakus opened this issue Apr 16, 2018 · 2 comments
Labels
Milestone

Comments

@wojtek-abakus
Copy link

Hello. I found an error in TouchGestureHandler in automatic Google logs. It happens approx 2 times a day in a 10000 users app.

java.lang.NullPointerException: at org.mapsforge.map.android.input.TouchGestureHandler.onSingleTapConfirmed (TouchGestureHandler.java:232) at android.view.GestureDetector$GestureHandler.handleMessage (GestureDetector.java:312) at android.os.Handler.dispatchMessage (Handler.java:102) at android.os.Looper.loop (Looper.java:158) at android.app.ActivityThread.main (ActivityThread.java:7224) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

In my opinion a touch event can move through the event queue after the fragment with map is changed and MapView's destroy method called (which nulls layerManager)

Could you please change the 231 line in TouchGestureHandler from
if (tapLatLong != null) {
to
if (tapLatLong != null && this.mapView.getLayerManager() != null) {

@devemux86
Copy link
Collaborator

Can check the LayerManager at start of both onLongPress and onSingleTapConfirmed methods in TouchGestureHandler.

Or better revert the nullify of LayerManager in MapView.destroy, introduced in #845, as doesn't seem to improve something there.

@devemux86 devemux86 added the bug label Apr 16, 2018
@devemux86 devemux86 added this to the 0.10.0 milestone Apr 16, 2018
@devemux86
Copy link
Collaborator

I reverted the nullify of LayerManager in MapView.destroy, introduced in #845.

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

No branches or pull requests

2 participants