[Android] Prevent NullPointerException when media title is null

Nicolas Pomepuy git at videolan.org
Tue Jul 5 09:32:26 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Jul  5 08:53:49 2022 +0200| [188d11fcb9522d56f34d567ebf3278087a8e43bb] | committer: Duncan McNamara

Prevent NullPointerException when media title is null

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

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

diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 499cbbf6f..7064d2694 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -1353,7 +1353,7 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner, CoroutineSc
         val queue = withContext(Dispatchers.Default) {
             ArrayList<MediaSessionCompat.QueueItem>(toIndex - fromIndex).also {
                 for ((position, media) in mediaList.subList(fromIndex, toIndex).withIndex()) {
-                    val title: String = media.nowPlaying ?: media.title
+                    val title: String? = media.nowPlaying ?: media.title
                     val mediaId = MediaSessionBrowser.generateMediaId(media)
                     val iconUri = when {
                         isSchemeHttpOrHttps(media.artworkMrl) -> {



More information about the Android mailing list