[Android] Prevent IndexOutOfBoundsException

Geoffrey Métais git at videolan.org
Fri Feb 24 16:32:03 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb 24 14:52:24 2017 +0100| [f49ef49096cdc2815a400e329f594a16ef0f2aaf] | committer: Geoffrey Métais

Prevent IndexOutOfBoundsException

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

 vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java | 2 ++
 1 file changed, 2 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 f6ffd28..fc29379 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -257,6 +257,8 @@ public class BaseBrowserAdapter extends RecyclerView.Adapter<BaseBrowserAdapter.
     }
 
     void removeItem(int position) {
+        if (position >= getItemCount())
+            return;
         MediaLibraryItem item = mMediaList.get(position);
         ArrayList<MediaLibraryItem> list = new ArrayList<>(mPendingUpdates.isEmpty() ? mMediaList : mPendingUpdates.peekLast());
         list.remove(position);



More information about the Android mailing list