Skip to content

Resolves NPE when opening app without location permission and mobile data #6345

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class NearbyParentFragmentPresenter
loadPlacesDataAyncJob?.cancel()
localPlaceSearchJob = scope.launch(Dispatchers.IO) {
delay(LOCAL_SCROLL_DELAY)
val mapFocus = nearbyParentFragmentView.mapFocus
val mapFocus = nearbyParentFragmentView.mapFocus ?: return@launch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to handle the case when Permission dialog is active above NearbyParentFragment leading to null values for nearbyParentFragment.mapFocus, nearbyParentFragment.screenBottomLeft and nearbyParentFragment.screenTopRight

Haven't tested yet but the NPE is happening at fetchPlaces() if I understand the logs correctly. Just thinking: can we still have cases where the other two could be null and we end up passing them to this function? Should we handle all of them since these are completely independent values and not calculated using any one of them?

val markerPlaceGroups = placesRepository.fetchPlaces(
nearbyParentFragmentView.screenBottomLeft,
nearbyParentFragmentView.screenTopRight
Expand Down