ubipo / osmfocus

Open source tool for examining OpenStreetMap elements by moving around on a map.
Apache License 2.0
43 stars 5 forks source link

Unhandled exception: Attempt to invoke virtual method 'org.osmdroid.views.MapViewRepository org.osmdroid.views.MapView.getRepository()' on a null object reference #26

Closed tuukka closed 3 years ago

tuukka commented 3 years ago

Exception details

Message: Attempt to invoke virtual method 'org.osmdroid.views.MapViewRepository org.osmdroid.views.MapView.getRepository()' on a null object reference

What happened / what actions did you take before the bug occurred?

I tapped the button to locate myself on the map. The button animation started, the map didn't move. Then I got this crash.

Stack trace

java.lang.NullPointerException: Attempt to invoke virtual method 'org.osmdroid.views.MapViewRepository org.osmdroid.views.MapView.getRepository()' on a null object reference
    at org.osmdroid.views.overlay.infowindow.InfoWindow.<init>(InfoWindow.java:3)
    at org.osmdroid.views.overlay.infowindow.BasicInfoWindow.<init>(BasicInfoWindow.java:1)
    at org.osmdroid.views.overlay.infowindow.MarkerInfoWindow.<init>(MarkerInfoWindow.java:1)
    at org.osmdroid.views.overlay.Marker.<init>(Marker.java:17)
    at net.pfiers.osmfocus.view.fragments.MapFragment.access$handleLocationUpdate(MapFragment.kt:15)
    at net.pfiers.osmfocus.view.fragments.MapFragment$onCreate$3$1$1$2$1.invokeSuspend(MapFragment.kt:6)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:3)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:18)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7697)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

System / app info

App version: 1.2.1-fdroid
App version code: 121
App build type: release
Android version: 29
Device name: ONEPLUS A5010
ubipo commented 3 years ago

I can't reproduce this directly but I can definitely see how this state can happen. Will include a fix in v1.2.2.

ubipo commented 3 years ago

Alright, 39410ec should've fixed it. It's published in v1.2.2. Let me know if it's no longer reproducible in that version.