[Android] Prevent IndexOutOfBoundsException

Geoffrey Métais git at videolan.org
Thu Jun 16 14:41:09 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun 16 14:40:31 2016 +0200| [26cc35cac12db07693c4566abe440ae08630a4cb] | committer: Geoffrey Métais

Prevent IndexOutOfBoundsException

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index 58edbaf..dba0640 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -250,7 +250,9 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
         }
 
         public void onClick(View v){
-            MediaWrapper media = mVideos.get(getAdapterPosition());
+            MediaWrapper media = getItem(getAdapterPosition());
+            if (media == null)
+                return;
             if (media instanceof MediaGroup) {
                 MainActivity activity = (MainActivity) mFragment.getActivity();
                 activity.showSecondaryFragment(SecondaryActivity.VIDEO_GROUP_LIST, media.getTitle());



More information about the Android mailing list