[Android] Prevent ArrayIndexOutOfBoundsException

Nicolas Pomepuy git at videolan.org
Mon Sep 28 13:40:06 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Sep 25 08:06:48 2020 +0200| [f2c78660f24deb14648f80cb0dc87cce9a528ff7] | committer: Nicolas Pomepuy

Prevent ArrayIndexOutOfBoundsException

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

 .../src/org/videolan/vlc/viewmodels/mobile/AudioBrowserViewModel.kt     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/AudioBrowserViewModel.kt b/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/AudioBrowserViewModel.kt
index f00a1ee6f..4e2e71226 100644
--- a/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/AudioBrowserViewModel.kt
+++ b/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/AudioBrowserViewModel.kt
@@ -70,7 +70,7 @@ class AudioBrowserViewModel(context: Context) : MedialibraryViewModel(context) {
     override fun refresh() {
         artistsProvider.showAll = settings.getBoolean(KEY_ARTISTS_SHOW_ALL, false)
         viewModelScope.launch {
-            providers[currentTab].awaitRefresh()
+            if (currentTab < providers.size) providers[currentTab].awaitRefresh()
             for ((index, provider) in providers.withIndex()) {
                 if (index != currentTab && provider.loading.hasObservers()) provider.awaitRefresh()
             }



More information about the Android mailing list