Skip to content

Commit 2dd2054

Browse files
lcor-ioleo cornillonm0nac0
authored
fix: correct bug on android where checking on activity lifecycles that were disposed (#266)
Co-authored-by: leo cornillon <[email protected]> Co-authored-by: m0nac0 <[email protected]>
1 parent 6ed4cfe commit 2dd2054

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

android/src/main/java/com/mapbox/mapboxgl/MapboxMapController.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,7 @@ public void onStyleLoaded(@NonNull Style style) {
363363
// is fixed with 0.6.0 of annotations plugin
364364
mapboxMap.addOnMapClickListener(MapboxMapController.this);
365365
mapboxMap.addOnMapLongClickListener(MapboxMapController.this);
366-
367-
localizationPlugin = new LocalizationPlugin(mapView, mapboxMap, style);
366+
localizationPlugin = new LocalizationPlugin(mapView, mapboxMap, style);
368367

369368
methodChannel.invokeMethod("map#onStyleLoaded", null);
370369
}
@@ -965,7 +964,7 @@ public boolean onMapLongClick(@NonNull LatLng point) {
965964

966965
@Override
967966
public void dispose() {
968-
if (disposed) {
967+
if (disposed || registrar.activity() == null) {
969968
return;
970969
}
971970
disposed = true;

0 commit comments

Comments
 (0)