Skip to content

App Crashes when LastKnownLocation is null #3371

@ashishkumar468

Description

@ashishkumar468

Summary:

Summarize your issue in one sentence (what goes wrong, what did you expect to happen)

  • On Granting Location Permission, if somehow last known location is null, app crashes

Steps to reproduce:
Open Nearby on Fresh Install, Grant Location Permission

System logs:

java.lang.NullPointerException: Attempt to invoke virtual method 'double fr.free.nrw.commons.location.LatLng.getLatitude()' on a null object reference
        at fr.free.nrw.commons.utils.LocationUtils.commonsLatLngToMapBoxLatLng(LocationUtils.java:11)
        at fr.free.nrw.commons.nearby.presenter.NearbyParentFragmentPresenter.areLocationsClose(NearbyParentFragmentPresenter.java:372)
        at fr.free.nrw.commons.nearby.fragments.NearbyParentFragment.isUserBrowsing(NearbyParentFragment.java:897)
        at fr.free.nrw.commons.nearby.fragments.NearbyParentFragment.onLocationChangedSignificantly(NearbyParentFragment.java:904)
        at fr.free.nrw.commons.location.LocationServiceManager.onLocationChanged(LocationServiceManager.java:183)
        at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:297)
        at android.location.LocationManager$ListenerTransport.-wrap0(LocationManager.java)
        at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:242)

Device and Android version:

Samsung S7, Api 27

Commons app version:
Current master

Would you like to work on the issue?
Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions