From b4cc12dfa337d8f28791be00f98e872e46167c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Sun, 20 Oct 2024 16:50:36 +0200 Subject: [PATCH] fix(android): fix crash calling clearData --- .../main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt b/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt index 55e4f7b02..f05030042 100644 --- a/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt +++ b/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt @@ -12,6 +12,7 @@ import com.rnmapbox.rnmbx.modules.RNMBXOfflineModule import com.rnmapbox.rnmbx.modules.RNMBXLocationModule import com.facebook.react.bridge.ReactMethod import com.facebook.react.common.MapBuilder +import com.mapbox.bindgen.None import com.mapbox.common.* import com.mapbox.maps.MapView import com.mapbox.maps.MapboxMap @@ -137,7 +138,11 @@ class RNMBXModule(private val mReactContext: ReactApplicationContext) : ReactCon mReactContext.runOnUiQueueThread { MapboxMap.clearData(mReactContext) { if (it.isValue) { - promise.resolve(it.value) + if (it.value == None.getInstance()) { + promise.resolve(null) + } else { + promise.resolve(it.value) + } } else { promise.reject("error", "RNMBXModule.clearError ${it.error}") }