getodk / collect

ODK Collect is an Android app for filling out forms. It's been used to collect billions of data points in challenging environments around the world. Contribute and make the world a better place! ✨📋✨
https://docs.getodk.org/collect-intro
Other
719 stars 1.37k forks source link

NullPointerException: Attempt to invoke virtual method 'float android.location.Location.getAccuracy()' on a null object reference #4962

Closed grzesiek2010 closed 2 years ago

grzesiek2010 commented 2 years ago

Software and hardware versions

Collect v2022.1-beta.0

Problem description

https://console.firebase.google.com/u/2/project/api-project-322300403941/crashlytics/app/android:org.odk.collect.android/issues/0e474160d58f47246060bec728b583c3?time=last-seven-days&versions=v2022.1-beta.0%20(4342)&sessionEventKey=61DEB0BD0366000111F2F8A684B9554F_1630718692977095893

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'float android.location.Location.getAccuracy()' on a null object reference
       at org.odk.collect.geo.GeoPointActivity.logSavePointManual(GeoPointActivity.java:232)
       at org.odk.collect.geo.GeoPointActivity.lambda$setupLocationDialog$0(GeoPointActivity.java:208)
       at org.odk.collect.geo.GeoPointActivity.$r8$lambda$9fPPLIJZceZ6GhevPMP1YYDbTrU(GeoPointActivity.java)
       at org.odk.collect.geo.GeoPointActivity$$InternalSyntheticLambda$0$20b2cb98c1124a1e4175c17f5deb4b7587b70f00d17be8c332623ecb8a973893$0.onClick(GeoPointActivity.java:2)
       at androidx.appcompat.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:193)
       at android.app.ActivityThread.main(ActivityThread.java:6758)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:497)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:912)
seadowg commented 2 years ago

We fixed the issue in the current release version but didn't bother porting the hotfix as we're replacing the implementation - we didn't think about this when releasing the beta though. We're deleting GeoPointActivity in #4963 which will take care of it anyway.