[Android] Write permission dialog: sanity check

Geoffrey Métais git at videolan.org
Wed Apr 10 14:58:18 CEST 2019


vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Apr 10 11:10:18 2019 +0200| [26cc6def5e9f175bd906880a84b3bb93c54eedec] | committer: Geoffrey Métais

Write permission dialog: sanity check

(cherry picked from commit ef76292a16eab095645aa5b3cfe294649934e3b1)

> https://code.videolan.org/videolan/vlc-android/commit/26cc6def5e9f175bd906880a84b3bb93c54eedec
---

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

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 e578b255b..9cd20b5f0 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
@@ -36,6 +36,7 @@ class WriteExternalDelegate : BaseHeadlessFragment() {
         builder.setMessage(R.string.sdcard_permission_dialog_message)
                 .setTitle(R.string.sdcard_permission_dialog_title)
                 .setPositiveButton(R.string.ok) { _, _ ->
+                    if (!isAdded || isDetached) return at setPositiveButton
                     val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
                     storage = arguments?.getString(KEY_STORAGE_PATH)?.apply { intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, Uri.parse(this)) }
                     startActivityForResult(intent, REQUEST_CODE_STORAGE_ACCESS)



More information about the Android mailing list