Catch all geocoding exceptions

Close #1381
This commit is contained in:
MM20 2025-06-29 18:19:58 +02:00
parent 6305d974eb
commit 85bfd9d79a
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -30,7 +30,7 @@ internal abstract class GeocoderWeatherProvider(
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
try { try {
geocoder.getFromLocationName(query, 10) geocoder.getFromLocationName(query, 10)
} catch (e: IOException) { } catch (e: Exception) {
CrashReporter.logException(e) CrashReporter.logException(e)
emptyList() emptyList()
} }
@ -51,7 +51,7 @@ internal abstract class GeocoderWeatherProvider(
Geocoder(context).getFromLocation(lat, lon, 1) Geocoder(context).getFromLocation(lat, lon, 1)
?.firstOrNull() ?.firstOrNull()
?.formatToString() ?: formatLatLon(lat, lon) ?.formatToString() ?: formatLatLon(lat, lon)
} catch (e: IOException) { } catch (e: Exception) {
CrashReporter.logException(e) CrashReporter.logException(e)
formatLatLon(lat, lon) formatLatLon(lat, lon)
} }