[Android] Prevent IndexOutOfBoundsException in audio browser
Geoffrey Métais
git at videolan.org
Thu Nov 23 11:24:32 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 23 11:20:17 2017 +0100| [ae5be6f2b60cbc1860bad88a02345d6d291b15d6] | committer: Geoffrey Métais
Prevent IndexOutOfBoundsException in audio browser
> https://code.videolan.org/videolan/vlc-android/commit/ae5be6f2b60cbc1860bad88a02345d6d291b15d6
---
vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java b/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
index af4618b59..cbb2d8484 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
@@ -93,12 +93,13 @@ public abstract class BaseAudioBrowser extends SortableFragment<AudioBrowserAdap
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
- int count = getCurrentAdapter().getSelectionCount();
+ final List<MediaLibraryItem> selection = getCurrentAdapter().getSelection();
+ final int count = selection.size();
if (count == 0) {
stopActionMode();
return false;
}
- boolean isSong = count == 1 && getCurrentAdapter().getSelection().get(0).getItemType() == MediaLibraryItem.TYPE_MEDIA;
+ boolean isSong = count == 1 && selection.get(0).getItemType() == MediaLibraryItem.TYPE_MEDIA;
menu.findItem(R.id.action_mode_audio_set_song).setVisible(isSong && AndroidDevices.isPhone);
menu.findItem(R.id.action_mode_audio_info).setVisible(count == 1);
menu.findItem(R.id.action_mode_audio_append).setVisible(mService.hasMedia());
More information about the Android
mailing list