[Android] Fix ArrayIndexOutOfBoundsException

Nicolas Pomepuy git at videolan.org
Wed Sep 2 09:41:28 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Sep  1 12:07:34 2020 +0200| [d0041aafe0133f30d1b3f80eb4fd54a8fde4d871] | committer: Nicolas Pomepuy

Fix ArrayIndexOutOfBoundsException

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

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

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
index f3231f086..5836d8ca9 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
@@ -195,7 +195,7 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>() {
         if (provider.loading.hasObservers()) return
         provider.pagedList.observe(viewLifecycleOwner, Observer { items ->
             @Suppress("UNCHECKED_CAST")
-            if (items != null) adapters[index].submitList(items as PagedList<MediaLibraryItem>?)
+            if (items != null) adapters.getOrNull(index)?.submitList(items as PagedList<MediaLibraryItem>?)
             updateEmptyView()
             restorePositions.get(index)?.let {
                 lists[index].scrollToPosition(it)



More information about the Android mailing list