-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Crash after granting permission. #1581
Comments
Thanks for this great issue report, and for offering to start working on it, please let us know about everything you find out :-) |
I am sorry I won't be able to finish this I have less time than I thought I'll have. But I found out that the problem is that the line:
in the method getLKL() in the class LocationServiceManager can return null. It is there as the second option used if the getLastKnownLocation with the GPS_PROVIDER returns null, but the code doesn't count with the option that also getLastKnownLocation with the NETWORK_PROVIDER could return null. |
Hi all, is this one sorted? If i download 2.8.4 on my Oreo phone from store and bug is still there. But when i forked master and installed app on emulator or phone i could not replicate the bug. Thx for info. (Trying to find something simple for my class to do) |
Hotfix for 2.8-release. Reintroduce lines from master to prevent crash: null chceck in LatLing getLKL method. Fixing bug in NearbyActivity. Dialog was not dismissed in activity after pressing positive button and turning on GPS.
Summary:
Commons crashing during granting a Location permission aftr first run. I am using Oreo device.
See the video: https://www.dropbox.com/s/3aig57i1x6pdcok/2018_06_02_17_20_08.mp4?dl=0
Steps to reproduce:
How can we reproduce the issue?
06-02 12:44:46.199 12044 12044 E AndroidRuntime: FATAL EXCEPTION: main 06-02 12:44:46.199 12044 12044 E AndroidRuntime: Process: fr.free.nrw.commons, PID: 12044 06-02 12:44:46.199 12044 12044 E AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=1, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {fr.free.nrw.commons/fr.free.nrw.commons.nearby.NearbyActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'double android.location.Location.getLatitude()' on a null object reference 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:4581) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4631) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at android.app.ActivityThread.-wrap19(Unknown Source:0) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1699) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:105) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at android.os.Looper.loop(Looper.java:180) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6944) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:835) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'double android.location.Location.getLatitude()' on a null object reference 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at fr.free.nrw.commons.location.LatLng.from(LatLng.java:45) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at fr.free.nrw.commons.location.LocationServiceManager.getLKL(LocationServiceManager.java:93) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at fr.free.nrw.commons.nearby.NearbyActivity.onRequestPermissionsResult(NearbyActivity.java:163) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7399) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at android.app.Activity.dispatchActivityResult(Activity.java:7250) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:4577) 06-02 12:44:46.199 12044 12044 E AndroidRuntime: ... 9 more
Expected behavior:
It should show the map.
Observed behavior:
Crash. After returning to the app again, the map is shown normally.
Device and Android version:
HTC 10, OS 8.0.0 Oreo, stock version
Commons app version:
2.7.1. downloaded from Play store
Video:
https://www.dropbox.com/s/3aig57i1x6pdcok/2018_06_02_17_20_08.mp4?dl=0
Would you like to work on the issue?
I would like to look at it. If I won't manage to fix this, I'll let you know.
The text was updated successfully, but these errors were encountered: