Skip to content

Conversation

@Kota-Jagadeesh
Copy link
Collaborator

Description

Fixes #6469

What changes did you make and why?

This pull request addresses a critical application crash (NullPointerException) that was triggered when users attempted an action requiring location data (like taking a picture from the "Nearby" tab) while the device was offline or had a severely flaky internet connection.

The root cause was that the NearbyParentFragmentPresenter attempted to fetch map boundary coordinates (screenBottomLeft and screenTopRight) from the map view. When offline, these coordinates were often uninitialized and returned null. This null value was then passed down to the Java data source method, leading to a crash when code attempted to call .getLatitude() on the null object.

The solution ensures robust handling of the offline/uninitialized state:

  1. NearbyParentFragmentPresenter.kt: Explicit null checks were added for screenBottomLeft and screenTopRight within the handleMapScrolled offline logic. If the map boundaries are null, the local place search job is now gracefully exited, preventing the null values from ever reaching the data layer.
  2. PlacesLocalDataSource.java: A defensive null check was implemented at the start of the fetchPlaces method. If either map boundary input is null, it now returns an empty list immediately instead of risking a NullPointerException on the map boundary processing logicc.

Tests performed (required)

Tested ProDebug on Redmi Note 13 Pro 5g with API level 35.

Screenshots (for UI changes only)

N/A (This is a code stability fix, not a UI change)

@github-actions
Copy link

✅ Generated APK variants!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: crash when attempting to take picture on nearby without Internet

1 participant