From 3b5b677699014d182c7170c1abc78847bd6e8b73 Mon Sep 17 00:00:00 2001 From: sailor Date: Sun, 18 Aug 2019 20:16:04 +0200 Subject: [PATCH] avoid ConcurrentModificationException --- app/build.gradle | 4 ++-- .../programmierecke/radiodroid2/StationSaveManager.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 734a5298a..1729e92ce 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,8 +20,8 @@ android { minSdkVersion 15 targetSdkVersion 28 - versionCode 88 - versionName "0.78" + versionCode 89 + versionName "0.79" multiDexEnabled true vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/net/programmierecke/radiodroid2/StationSaveManager.java b/app/src/main/java/net/programmierecke/radiodroid2/StationSaveManager.java index a385b087d..240b98062 100644 --- a/app/src/main/java/net/programmierecke/radiodroid2/StationSaveManager.java +++ b/app/src/main/java/net/programmierecke/radiodroid2/StationSaveManager.java @@ -171,14 +171,14 @@ void refreshStationsFromServer() { new AsyncTask() { @Override protected Integer doInBackground(Void... params) { - int deletedCount = 0; + ArrayList stationsToRemove = new ArrayList(); for (DataRadioStation station : listStations) { if (!station.refresh(httpClient, context) && !station.hasValidUuid() && station.RefreshRetryCount > DataRadioStation.MAX_REFRESH_RETRIES) { - listStations.remove(station); - deletedCount++; + stationsToRemove.add(station); } } - return deletedCount; + listStations.removeAll(stationsToRemove); + return stationsToRemove.size(); } @Override