From 8bae64098bb44516f99ce46a4367f52a8d8bcebb Mon Sep 17 00:00:00 2001 From: Tobrun Van Nuland Date: Tue, 12 Sep 2017 09:56:09 +0200 Subject: [PATCH] [android] - harden offline region deletion --- .../main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java index 1b8c4121ef8..f210729037e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java @@ -358,10 +358,10 @@ public void run() { */ public void delete(@NonNull final OfflineRegionDeleteCallback callback) { if (!isDeleted) { + isDeleted = true; deleteOfflineRegion(new OfflineRegionDeleteCallback() { @Override public void onDelete() { - isDeleted = true; getHandler().post(new Runnable() { @Override public void run() { @@ -376,6 +376,7 @@ public void onError(final String error) { getHandler().post(new Runnable() { @Override public void run() { + isDeleted = false; callback.onError(error); } });