[Android] Check for IndexOutOfBoundsException

Geoffrey Métais git at videolan.org
Fri May 27 10:01:14 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri May 27 09:59:25 2016 +0200| [11aa8a75f3ad8441b2e4939c101adf5278ef124f] | committer: Geoffrey Métais

Check for IndexOutOfBoundsException

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

 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 11c5441..691c997 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -92,7 +92,9 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
 
     @Override
     public void onBindViewHolder(ViewHolder holder, int position) {
-        MediaWrapper media = mVideos.get(position);
+        MediaWrapper media = getItem(position);
+        if (media == null)
+            return;
         holder.binding.setVariable(BR.scaleType, ImageView.ScaleType.FIT_CENTER);
         fillView(holder, media);
 



More information about the Android mailing list