[Android] Playlist: Sanity check
Geoffrey Métais
git at videolan.org
Fri Apr 12 15:02:05 CEST 2019
vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr 12 13:23:17 2019 +0200| [07676ab2c6347aad9ce23637bf74b81d48b7fefe] | committer: Geoffrey Métais
Playlist: Sanity check
(cherry picked from commit 58af3c9e291d4f3371d055673c62af5a4f5f541d)
> https://code.videolan.org/videolan/vlc-android/commit/07676ab2c6347aad9ce23637bf74b81d48b7fefe
---
vlc-android/src/org/videolan/vlc/viewmodels/PlaylistModel.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/PlaylistModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/PlaylistModel.kt
index 1da132df9..b003ffda0 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/PlaylistModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/PlaylistModel.kt
@@ -105,7 +105,7 @@ class PlaylistModel : ScopedModel(), PlaybackService.Callback by EmptyPBSCallbac
fun getPlaylistPosition(position: Int, media: MediaWrapper): Int {
val list = originalDataset ?: dataset.value
- if (list[position] == media) return position
+ if (position in 0 until list.size && list[position] == media) return position
else {
for ((index, item) in list.withIndex()) if (item == media) {
return index
More information about the Android
mailing list