[Android] Fix off-by-1 ArrayOutOfBoundsException

Geoffrey Métais git at videolan.org
Tue Jan 3 17:13:08 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan  3 14:30:12 2017 +0100| [30cfcdb69de0dd8f9c9d19c4d657d9da616b136a] | committer: Geoffrey Métais

Fix off-by-1 ArrayOutOfBoundsException

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

 vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index f8df815..d0b8062 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -292,8 +292,8 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDis
 
         if (id == R.id.audio_list_browser_delete) {
             final MediaLibraryItem mediaLibraryItem = adapter.getItem(position);
-            final MediaLibraryItem previous = position> 0 ? adapter.getItem(position-1) : null;
-            final MediaLibraryItem next = position < adapter.getItemCount() ? adapter.getItem(position+1) : null;
+            final MediaLibraryItem previous = position > 0 ? adapter.getItem(position-1) : null;
+            final MediaLibraryItem next = position < adapter.getItemCount()-1 ? adapter.getItem(position+1) : null;
             String message;
             Runnable action;
             final MediaLibraryItem separator = previous != null && previous.getItemType() == MediaLibraryItem.TYPE_DUMMY &&



More information about the Android mailing list