[Android] Browser: don't crash on custom paths

Sébastien Toque git at videolan.org
Sat May 18 15:05:51 CEST 2013


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sat May 18 15:05:21 2013 +0200| [3d2f0dc999a53a3974163b5fdd1911c6ce165d6e] | committer: Sébastien Toque

Browser: don't crash on custom paths

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=3d2f0dc999a53a3974163b5fdd1911c6ce165d6e
---

 vlc-android/src/org/videolan/vlc/gui/BrowserAdapter.java |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/BrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/BrowserAdapter.java
index 93419d2..6e282c8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/BrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/BrowserAdapter.java
@@ -120,11 +120,10 @@ public class BrowserAdapter extends ArrayAdapter<File>
 
             if (buttonView.isEnabled() && isChecked) {
                 dbManager.addDir(item.getPath());
-                File tmpFile = item;
-                while (tmpFile.getPath() != null && !tmpFile.getPath().equals("/")) {
+                File tmpFile = item.getParentFile();
+                while (tmpFile != null && !tmpFile.getPath().equals("/")) {
+                    dbManager.removeDir(tmpFile.getPath());
                     tmpFile = tmpFile.getParentFile();
-                    if (tmpFile != null)
-                        dbManager.removeDir(tmpFile.getPath());
                 }
             } else {
                 dbManager.removeDir(item.getPath());



More information about the Android mailing list