From 30060b5729aa3ab085129ac1bea2d301555b5034 Mon Sep 17 00:00:00 2001 From: Marco Romano Date: Wed, 19 Jul 2023 16:33:50 +0200 Subject: [PATCH] Don't crash when sharing a location with no maptiler apikey (#919) Related to: - https://github.com/vector-im/element-meta/issues/1682 --- .../android/features/location/impl/send/SendLocationView.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationView.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationView.kt index 5fa5010084..1a30c996a8 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationView.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationView.kt @@ -133,7 +133,10 @@ fun SendLocationView( ) ) }, - modifier = Modifier.clickable { + modifier = Modifier.clickable( + // target is null when the map hasn't loaded (or api key is wrong) so we disable the button + enabled = cameraPositionState.position.target != null + ) { state.eventSink( SendLocationEvents.SendLocation( cameraPosition = SendLocationEvents.SendLocation.CameraPosition(