[Android] Fix crash when playlist has no media

Nicolas Pomepuy git at videolan.org
Thu Apr 11 18:38:02 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Fri Apr  5 09:57:11 2019 +0200| [1582198cbdee1ed09045b4201794414241ee4ebd] | committer: Geoffrey Métais

Fix crash when playlist has no media

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

 vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.kt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.kt b/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.kt
index f12421235..cf6c2c6fd 100644
--- a/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.kt
@@ -106,6 +106,9 @@ object ThumbnailsProvider {
      * @return a Bitmap object
      */
     private suspend fun composePlaylistImage(mediaList: List<MediaWrapper>, width: Int): Bitmap? {
+        if (mediaList.isEmpty()) {
+            return null
+        }
         val url = mediaList[0].artworkURL
         val isAllSameImage = !mediaList.any { it.artworkURL != url }
 



More information about the Android mailing list