Skip to content

Handle empty location results in live sharing - #3890

Closed
blihio wants to merge 1 commit into
microg:masterfrom
blihio:codex/guard-empty-location-result
Closed

blihio wants to merge 1 commit into
microg:masterfrom
blihio:codex/guard-empty-location-result

Conversation

@blihio

@blihio blihio commented Oct 16, 2026

Copy link
Copy Markdown

What changed

Handle an empty LocationResult before reading coordinates in the live location sharing callback. LocationResult.getLastLocation() returns null when its list is empty; the existing code read latitude before its later null check, causing a NullPointerException and skipping the callback's normal handling.

The callback now returns for a missing location. Non-empty results follow the existing logging and upload path.

Evidence

  • XLint reported the dereference in LocationSharingUpdate.kt as Uncertain Nullable Platform Caller (possible bug, MEDIUM) in upstream commit 32bc8954ff872d0e1a05ddfae81561b6dbecef69.
  • LocationResult.getLastLocation() documents and implements the empty-list return as null.
  • A targeted JVM harness using the unchanged callback source and the repository's Java LocationResult/LocationCallback reproduced the NPE for an empty result. A local fixed copy completed safely for empty and non-empty results.

Closes #3889

Validation limits

The reproduction uses stubs for Android and unrelated service boundaries; it does not claim a full Android instrumentation run or a full Gradle build. No behavior outside the null guard is changed.

@blihio blihio closed this Oct 16, 2026
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.

Avoid a crash when a location update has no location

1 participant