[Android] Fix NullPointerException

Nicolas Pomepuy git at videolan.org
Fri Nov 29 11:10:07 CET 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Thu Nov 28 07:35:12 2019 +0100| [9cdff021ae4c392ef3861732ec9c2ba72a4bbd55] | committer: Geoffrey Métais

Fix NullPointerException

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

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

diff --git a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
index e543f9a07..cd3fe473d 100644
--- a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+++ b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
@@ -134,7 +134,7 @@ fun List<AbstractMediaWrapper>.updateWithMLMeta() : MutableList<AbstractMediaWra
 @ExperimentalCoroutinesApi
 @ObsoleteCoroutinesApi
 suspend fun String.scanAllowed() = withContext(Dispatchers.IO) {
-    val file = File(Uri.parse(this at scanAllowed).path)
+    val file = File(Uri.parse(this at scanAllowed).path ?: return at withContext false)
     if (!file.exists() || !file.canRead()) return at withContext false
     if (AndroidDevices.watchDevices && file.list()?.any { it == ".nomedia" } == true) return at withContext false
     true



More information about the Android mailing list