[Android] Fix FilePicker crash

Geoffrey Métais git at videolan.org
Wed Feb 24 19:00:54 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 24 18:47:44 2016 +0100| [13a032d4bd7e16f81fd02e3f41b0db40757ef64b] | committer: Geoffrey Métais

Fix FilePicker crash

> https://code.videolan.org/videolan/vlc-android/commit/13a032d4bd7e16f81fd02e3f41b0db40757ef64b
---

 .../src/org/videolan/vlc/gui/browser/FilePickerAdapter.java       | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java
index 63c50c9..2c72b60 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java
@@ -36,9 +36,13 @@ public class FilePickerAdapter extends BaseBrowserAdapter {
     }
 
     public void addItem(Object media, boolean notify, boolean top){
-        MediaWrapper mediaWrapper = new MediaWrapper((Media)media);
+        MediaWrapper mediaWrapper;
+        if (media instanceof MediaWrapper)
+            mediaWrapper = (MediaWrapper) media;
+        else
+            mediaWrapper = new MediaWrapper((Media)media);
         if (filter(mediaWrapper))
-            addItem(mediaWrapper, notify, top);
+            super.addItem(mediaWrapper, notify, top);
     }
 
     public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {



More information about the Android mailing list