[Android] MediaListActivity: Fix OutOfBoundsException

Geoffrey Métais git at videolan.org
Thu Sep 12 16:34:30 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 12 11:50:23 2019 +0200| [633fcbc8e6d491197e827fb35990b8ac735b5352] | committer: Geoffrey Métais

MediaListActivity: Fix OutOfBoundsException

(cherry picked from commit a1ecc68ddfbf1a0fefc6122c114c4d9c5f8f6e0d)

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

 .../src/org/videolan/vlc/gui/tv/details/MediaListActivity.kt        | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/details/MediaListActivity.kt b/vlc-android/src/org/videolan/vlc/gui/tv/details/MediaListActivity.kt
index 804332f96..df0e355c5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/details/MediaListActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/details/MediaListActivity.kt
@@ -47,10 +47,7 @@ class MediaListActivity : BaseTvActivity(), ITVEventsHandler, CoroutineScope by
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         binding = DataBindingUtil.setContentView(this, R.layout.activity_media_list_tv)
-        item = if (savedInstanceState != null)
-            savedInstanceState.getParcelable<Parcelable>(ITEM) as MediaLibraryItem
-        else
-            intent.getParcelableExtra<Parcelable>(ITEM) as MediaLibraryItem
+        item = (savedInstanceState?.getParcelable(ITEM) ?: intent.getParcelableExtra<Parcelable>(ITEM)) as MediaLibraryItem
         binding.item = item
 
         backgroundManager = BackgroundManager.getInstance(this)
@@ -66,7 +63,6 @@ class MediaListActivity : BaseTvActivity(), ITVEventsHandler, CoroutineScope by
         binding.mediaList.layoutManager = linearLayoutManager
         binding.mediaList.adapter = adapter
         adapter.update(item.tracks.toList())
-        item.tracks[0].length
 
         binding.mediaList.addItemDecoration(dividerItemDecoration)
 



More information about the Android mailing list