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

[Bug]: Crash when opening Nearby when location permission hasn't been granted yet #5413

Closed
sivaraam opened this issue Dec 31, 2023 · 9 comments · Fixed by #5418
Closed

[Bug]: Crash when opening Nearby when location permission hasn't been granted yet #5413

sivaraam opened this issue Dec 31, 2023 · 9 comments · Fixed by #5418

Comments

@sivaraam
Copy link
Member

sivaraam commented Dec 31, 2023

Summary

The app crashes when trying to open the Nearby screen. I observe this on a fresh installation when the app doesn't have the location permission.

Steps to reproduce

  1. Install the app afresh
  2. Login to the app
  3. Click on Nearby
  4. Observe the app crashing (likely due to lack of location permission)

Expected behaviour

The app should open the Nearby screen properly requesting for the location permission.

Actual behaviour

The app crashes with the exception trace found below. The location permission request is shown after the app screen goes away.

Device name

OnePlus Nord

Android version

12

Commons app version

Should be reproducible on master

Device logs

java.lang.RuntimeException: Unable to resume activity {fr.free.nrw.commons/fr.free.nrw.commons.contributions.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'double org.osmdroid.util.GeoPoint.getLatitude()' on a null object reference
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4935)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4974)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:60)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2345)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:344)
at android.app.ActivityThread.main(ActivityThread.java:8212)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

Screen-shots

No response

Would you like to work on the issue?

None

@ShashwatKedia
Copy link
Contributor

@nicolas-raoul @sivaraam I would like to work on this issue, if no one else is on it.

@ShashwatKedia
Copy link
Contributor

I tried to reproduce this issue on some physical devices (Android 13, 12 and 8), but the app behaved correctly, asking for permission first and thus did not crash. Interestingly, it did crash on both the emulators I tested upon, with the same device logs as given above.

@rohit9625
Copy link
Contributor

I faced the same issue on my device that has android 14.

ShashwatKedia added a commit to ShashwatKedia/apps-android-commons that referenced this issue Jan 3, 2024
ShashwatKedia added a commit to ShashwatKedia/apps-android-commons that referenced this issue Jan 3, 2024
@ShashwatKedia
Copy link
Contributor

@sivaraam @nicolas-raoul Kindly review the above PR :]

ShashwatKedia added a commit to ShashwatKedia/apps-android-commons that referenced this issue Jan 15, 2024
@abhineshchandra1234

This comment was marked as off-topic.

@nicolas-raoul

This comment was marked as off-topic.

@nicolas-raoul
Copy link
Member

@sivaraam As the original reporter, would you mind checking? :-)

@bhoomigadhiya
Copy link

Does this issue still persist?

@nicolas-raoul
Copy link
Member

@bhoomigadhiya Sorry we will test @ShashwatKedia 's pull request soon.

nicolas-raoul pushed a commit that referenced this issue Jan 27, 2024
…on hasn't been granted yet (#5418)

* Resolves Issue #5413

* Added Javadoc and formatted code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants