[Android] Add nullity check

Geoffrey Métais git at videolan.org
Tue Jan 30 11:01:13 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 30 10:53:44 2018 +0100| [1cbd6a81525a887966e468c582f70bf4fee68630] | committer: Geoffrey Métais

Add nullity check

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

 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 62ac057fa..b566d46bf 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -422,9 +422,10 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
     }
 
     private suspend fun determinePrevAndNextIndices(expand: Boolean = false) {
-        if (expand) {
+        val media = getCurrentMedia()
+        if (expand && media !== null) {
             expanding = true
-            nextIndex = expand(getCurrentMedia()!!.type == MediaWrapper.TYPE_STREAM)
+            nextIndex = expand(media.type == MediaWrapper.TYPE_STREAM)
             expanding = false
         } else {
             nextIndex = -1



More information about the Android mailing list