[Android] Audioplayer: sanity check for context actions

Geoffrey Métais git at videolan.org
Mon Sep 23 18:10:27 CEST 2019


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep 11 11:03:34 2019 +0200| [ae93c7bd6b3cfd983e99fd6d243ec7a3000023fa] | committer: Geoffrey Métais

Audioplayer: sanity check for context actions

(cherry picked from commit 695a96e25a839ced0c8b2ba023f15963cb8d36a3)

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

 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index c11b64eb5..52bfcb2fc 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -179,7 +179,7 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, CoroutineS
 
     private val ctxReceiver: CtxActionReceiver = object : CtxActionReceiver {
         override fun onCtxAction(position: Int, option: Int) {
-            when (option) {
+            if (position in 0 until playlistAdapter.itemCount) when (option) {
                 CTX_SET_RINGTONE -> AudioUtil.setRingtone(playlistAdapter.getItem(position), requireActivity())
                 CTX_ADD_TO_PLAYLIST -> {
                     val mw = playlistAdapter.getItem(position)



More information about the Android mailing list