[Android] Fix crash when playing a lot of videos

Nicolas Pomepuy git at videolan.org
Thu Aug 13 11:59:48 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Aug 13 10:18:11 2020 +0200| [b66d8a9ecd41bbe472b3b232686d185e27917623] | committer: Nicolas Pomepuy

Fix crash when playing a lot of videos

Fixes #1455

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

 application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt b/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt
index e44e941a0..cabce930e 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt
@@ -248,7 +248,7 @@ object MediaUtils {
                     while (index < count) {
                         val pageCount = min(MEDIALIBRARY_PAGE_SIZE, count - index)
                         val list = withContext(Dispatchers.IO) {
-                            provider.getPage(pageCount, index).toList()
+                            provider.getPage(pageCount, index).toList() as List<MediaWrapper>
                         }
                         if (index == 0) play(list)
                         else service.append(list)
@@ -537,7 +537,7 @@ fun List<Folder>.getAll(type: Int = Folder.TYPE_FOLDER_VIDEO, sort: Int = Medial
 private fun Array<MediaLibraryItem>.toList() = flatMap {
     if (it is VideoGroup) {
         it.media(Medialibrary.SORT_DEFAULT, false, it.mediaCount(), 0).toList()
-    } else listOf(this as MediaWrapper)
+    } else listOf(it as MediaWrapper)
 }
 
 fun MediaContentResolver.canHandle(id: String) : Boolean {



More information about the Android mailing list