[Android] Prevent NPE in subs picker

Geoffrey Métais git at videolan.org
Tue Nov 21 11:25:42 CET 2017


vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov 21 11:14:06 2017 +0100| [b1150a68da3ef0c0c9c2e7547ec13cf839e2969c] | committer: Geoffrey Métais

Prevent NPE in subs picker

(cherry picked from commit 42d48603a28dbd1d9a9e156c6f3e147aae3c3813)

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

 vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
index 3b98dbec1..857ab28fd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -211,7 +211,8 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
 
         @Override
         protected boolean isSelected() {
-            return getItem(getLayoutPosition()).hasStateFlags(FLAG_SELECTED);
+            final MediaLibraryItem item = getItem(getLayoutPosition());
+            return item != null && item.hasStateFlags(FLAG_SELECTED);
         }
     }
 



More information about the Android mailing list