Skip to content

Commit

Permalink
fix(android): fix crash calling clearData (#3661)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas authored Oct 20, 2024
1 parent 7999235 commit d6ed261
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 d6ed261

Please sign in to comment.