[Android] Write permission dialog: sanity check

Geoffrey Métais git at videolan.org
Wed Apr 10 11:10:55 CEST 2019


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

Write permission dialog: sanity check

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

 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