[Android] Prevent ArrayIndexOutOfBoundsException
Geoffrey Métais
git at videolan.org
Tue Mar 29 13:32:01 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 29 13:16:08 2016 +0200| [f10e7063195dd6866ba568881f89450756052383] | committer: Geoffrey Métais
Prevent ArrayIndexOutOfBoundsException
> https://code.videolan.org/videolan/vlc-android/commit/f10e7063195dd6866ba568881f89450756052383
---
vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java | 4 ++++
1 file changed, 4 insertions(+)
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 9d5b8f2..b25f15f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -326,6 +326,8 @@ public class BaseBrowserAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
}
public Object getItem(int position){
+ if (position < 0 || position >= mMediaList.size())
+ return null;
return mMediaList.get(position);
}
@@ -393,6 +395,8 @@ public class BaseBrowserAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
protected void openMediaFromView(MediaViewHolder holder, View v) {
final MediaWrapper mw = (MediaWrapper) getItem(holder.getAdapterPosition());
+ if (mw == null)
+ return;
mw.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
if (mw.getType() == MediaWrapper.TYPE_DIR)
More information about the Android
mailing list