[Android] Prevent ArrayIndexOutOfBoundsException

Nicolas Pomepuy git at videolan.org
Thu Jul 2 11:51:03 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Jul  2 08:36:35 2020 +0200| [f3f62654cf8bcad4ae2ffc5bdb73f4d3ce5a92db] | committer: Nicolas Pomepuy

Prevent ArrayIndexOutOfBoundsException

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

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

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 0b5299ff1..f3231f086 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
@@ -156,6 +156,7 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>() {
         super.onConfigurationChanged(newConfig)
         val itemSize = RecyclerSectionItemGridDecoration.getItemSize(requireActivity().getScreenWidth(), nbColumns, spacing)
         for (i in 0 until MODE_TOTAL) {
+            if (i >= lists.size || i >= adapters.size) continue
             if (lists[i].layoutManager is GridLayoutManager) {
                 val gridLayoutManager = lists[i].layoutManager as GridLayoutManager
                 gridLayoutManager.spanCount = nbColumns



More information about the Android mailing list