summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-11-06 11:48:29 +0100
committerTobrun <tobrun@mapbox.com>2018-11-07 10:34:01 +0100
commitf560b4f9efebb4d448181724304f63b683a26b67 (patch)
tree6826da3766251e4acc942ba3237773c8c9982ea4 /platform
parentf2d9d92d26e0476adaf3e4263b77bfb8f38d6d35 (diff)
downloadqtlocation-mapboxgl-f560b4f9efebb4d448181724304f63b683a26b67.tar.gz
[android] - handle null getMapAsync invocations, deliver onMapReady only once
Diffstat (limited to 'platform')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
index 20bb49f140..d6dcce434d 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
@@ -1149,13 +1149,18 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
}
}
+ /**
+ * Notify listeners, clear when done
+ */
private void onMapReady() {
if (onMapReadyCallbackList.size() > 0) {
- // Notify listeners, clear when done
Iterator<OnMapReadyCallback> iterator = onMapReadyCallbackList.iterator();
while (iterator.hasNext()) {
OnMapReadyCallback callback = iterator.next();
- callback.onMapReady(mapboxMap);
+ if (callback != null) {
+ // null checking required for #13279
+ callback.onMapReady(mapboxMap);
+ }
iterator.remove();
}
}
@@ -1190,6 +1195,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
public void onDidFinishLoadingStyle() {
if (mapboxMap != null) {
if (initialLoad) {
+ initialLoad = false;
mapboxMap.onPreMapReady();
onMapReady();
mapboxMap.onPostMapReady();