From 1f63a5e631eb5c7335157ba58fc31b5120fadad4 Mon Sep 17 00:00:00 2001 From: blihio <138576710+blihio@users.noreply.github.com> Date: Fri, 16 Oct 2026 20:52:26 +0800 Subject: [PATCH] Handle empty location results in location sharing --- .../service/LocationSharingUpdate.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/play-services-core/src/main/kotlin/com/google/android/gms/locationsharingreporter/service/LocationSharingUpdate.kt b/play-services-core/src/main/kotlin/com/google/android/gms/locationsharingreporter/service/LocationSharingUpdate.kt index c6ddcd2b33..8c10835233 100644 --- a/play-services-core/src/main/kotlin/com/google/android/gms/locationsharingreporter/service/LocationSharingUpdate.kt +++ b/play-services-core/src/main/kotlin/com/google/android/gms/locationsharingreporter/service/LocationSharingUpdate.kt @@ -70,9 +70,9 @@ class LocationSharingUpdate { val locationCallback = object : LocationCallback() { override fun onLocationResult(locationResult: LocationResult?) { locationResult ?: return - val location = locationResult.lastLocation + val location = locationResult.lastLocation ?: return Log.d(TAG, "Location update: ${location.latitude}, ${location.longitude}}") - if (accountInfo != null && location != null && appContext != null) { + if (accountInfo != null && appContext != null) { val locationSharingEnabled = isLocationSharingEnabled(appContext!!, accountInfo!!.name) if (locationSharingEnabled) { CoroutineScope(Dispatchers.IO).launch { @@ -93,4 +93,4 @@ class LocationSharingUpdate { return locationCallback } } -} \ No newline at end of file +}