diff --git a/mapcache/src/main/java/mil/nga/mapcache/MapFeaturesUpdateTask.java b/mapcache/src/main/java/mil/nga/mapcache/MapFeaturesUpdateTask.java index 200992df..481357f6 100644 --- a/mapcache/src/main/java/mil/nga/mapcache/MapFeaturesUpdateTask.java +++ b/mapcache/src/main/java/mil/nga/mapcache/MapFeaturesUpdateTask.java @@ -346,9 +346,9 @@ private void displayFeatures(GeoPackage geoPackage, StyleCache styleCache, Strin + ", row: " + cursor.getPosition(), e); } } - if(getErrorCount() > 0){ + int totalErrors = getErrorCount(); + if(totalErrors > 0){ new Handler(Looper.getMainLooper()).post(() -> { - Toast toast = Toast.makeText(activity, "Error loading geometry", Toast.LENGTH_SHORT); toast.show(); }); @@ -404,9 +404,10 @@ private void processFeatureIndexResults(FeatureIndexResults indexResults, String } } finally { indexResults.close(); - if(getErrorCount() > 0){ + int totalErrors = getErrorCount(); + if(totalErrors > 0){ new Handler(Looper.getMainLooper()).post(() -> { - Toast toast = Toast.makeText(activity, getErrorCount() + " Geometries failed to load", Toast.LENGTH_SHORT); + Toast toast = Toast.makeText(activity, totalErrors + " Geometries failed to load", Toast.LENGTH_SHORT); toast.show(); }); setErrorCount(0);