[Android] Fix NullPointerException

Nicolas Pomepuy git at videolan.org
Wed Sep 1 11:39:51 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Aug 30 12:03:07 2021 +0200| [11ec9b73a35ccb54153b34e73ba77c018f1bac5b] | committer: Nicolas Pomepuy

Fix NullPointerException

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

 .../org/videolan/vlc/providers/medialibrary/VideoGroupsProvider.kt    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/providers/medialibrary/VideoGroupsProvider.kt b/application/vlc-android/src/org/videolan/vlc/providers/medialibrary/VideoGroupsProvider.kt
index bf8ce4950..7960995df 100644
--- a/application/vlc-android/src/org/videolan/vlc/providers/medialibrary/VideoGroupsProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/providers/medialibrary/VideoGroupsProvider.kt
@@ -57,8 +57,8 @@ private fun Array<VideoGroup>.sanitizeGroups() = map { videoGroup ->
  * Update the [VideoGroup.isNetwork] flag if needed (at least one media is a network one)
  */
 private fun checkIsNetwork(videoGroup: VideoGroup) {
-    videoGroup.media(Medialibrary.SORT_DEFAULT, false, true, videoGroup.mediaCount(), 0).forEach {
-        if (it?.uri?.scheme?.isSchemeFile() == false) {
+    videoGroup.media(Medialibrary.SORT_DEFAULT, false, true, videoGroup.mediaCount(), 0).filterNotNull().forEach {
+        if (it.uri?.scheme?.isSchemeFile() == false) {
             videoGroup.isNetwork = true
             return at forEach
         }



More information about the Android mailing list