Skip to content

Commit

Permalink
fix(android): fix crash calling clearData
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas committed Oct 20, 2024
1 parent 7999235 commit b4cc12d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}")
}
Expand Down

0 comments on commit b4cc12d

Please sign in to comment.