[Android] Prevent NPE when removable storage is not found

Geoffrey Métais git at videolan.org
Thu Mar 22 11:44:53 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Mar 22 10:33:42 2018 +0100| [13a123e6e898717de9c24229c519adb527bad603] | committer: Geoffrey Métais

Prevent NPE when removable storage is not found

> https://code.videolan.org/videolan/vlc-android/commit/13a123e6e898717de9c24229c519adb527bad603
---

 .../src/org/videolan/vlc/gui/helpers/hf/WriteExternalDelegate.kt        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/hf/WriteExternalDelegate.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/hf/WriteExternalDelegate.kt
index 99dd48d6a..89e3595bd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/hf/WriteExternalDelegate.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/hf/WriteExternalDelegate.kt
@@ -92,7 +92,7 @@ class WriteExternalDelegate : BaseHeadlessFragment() {
             if (activity === null) return
             val fragment = WriteExternalDelegate()
             callback = cb
-            storage = FileUtils.getMediaStorage(uri)
+            storage = FileUtils.getMediaStorage(uri) ?: return
             fragment.arguments = Bundle(1).apply { putString(KEY_STORAGE_PATH, storage) }
             activity.supportFragmentManager.beginTransaction().add(fragment, TAG).commitAllowingStateLoss()
         }



More information about the Android mailing list