[Android] Fix concurrent access exception

Geoffrey Métais git at videolan.org
Fri Feb 26 14:59:59 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb 26 12:00:37 2016 +0100| [1759a56613dd6c00318bedf6cf13d5723638d6f8] | committer: Geoffrey Métais

Fix concurrent access exception

> https://code.videolan.org/videolan/vlc-android/commit/1759a56613dd6c00318bedf6cf13d5723638d6f8
---

 .../src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
index 489be68..120f731 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
@@ -159,11 +159,14 @@ public class NetworkBrowserFragment extends BaseBrowserFragment implements View.
         if (newSize == 0 && mFavorites == 0)
             return;
         if (!AndroidDevices.hasLANConnection()) {
+            ArrayList<MediaWrapper> toRemove = new ArrayList<>();
             List<String> schemes = Arrays.asList("ftp", "sftp", "ftps", "http", "https");
-            for (MediaWrapper mw : favs) {
+            for (MediaWrapper mw : favs)
                 if (!schemes.contains(mw.getUri().getScheme()))
+                    toRemove.add(mw);
+            if (!toRemove.isEmpty())
+                for (MediaWrapper mw : toRemove)
                     favs.remove(mw);
-            }
             newSize = favs.size();
             if (newSize == 0) {
                 if (mFavorites != 0) {



More information about the Android mailing list