diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/InfoWindowManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/InfoWindowManager.java index 7599b6afa6c..0b461d12273 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/InfoWindowManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/InfoWindowManager.java @@ -22,7 +22,8 @@ */ class InfoWindowManager { - private List infoWindows; + private final List infoWindows = new ArrayList<>(); + private MapboxMap.InfoWindowAdapter infoWindowAdapter; private boolean allowConcurrentMultipleInfoWindows; @@ -30,13 +31,11 @@ class InfoWindowManager { private MapboxMap.OnInfoWindowLongClickListener onInfoWindowLongClickListener; private MapboxMap.OnInfoWindowCloseListener onInfoWindowCloseListener; - InfoWindowManager() { - this.infoWindows = new ArrayList<>(); - } - void update() { - for (InfoWindow infoWindow : infoWindows) { - infoWindow.update(); + if (!infoWindows.isEmpty()) { + for (InfoWindow infoWindow : infoWindows) { + infoWindow.update(); + } } } @@ -56,10 +55,6 @@ boolean isAllowConcurrentMultipleOpenInfoWindows() { return allowConcurrentMultipleInfoWindows; } - List getInfoWindows() { - return infoWindows; - } - boolean isInfoWindowValidForMarker(@NonNull Marker marker) { return !TextUtils.isEmpty(marker.getTitle()) || !TextUtils.isEmpty(marker.getSnippet()); }