[Android] Cancel permission request if fragment is detached

Geoffrey Métais git at videolan.org
Thu Mar 7 10:55:17 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Mar  7 09:57:28 2019 +0100| [56c7af08890910827c2e7a94121764b7ea9623df] | committer: Geoffrey Métais

Cancel permission request if fragment is detached

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

 .../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 b604d77e7..e578b255b 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
@@ -31,7 +31,7 @@ class WriteExternalDelegate : BaseHeadlessFragment() {
 
     @TargetApi(Build.VERSION_CODES.O)
     private fun showDialog() {
-        if (!isAdded) return
+        if (!isAdded || isDetached) return
         val builder = AlertDialog.Builder(requireActivity())
         builder.setMessage(R.string.sdcard_permission_dialog_message)
                 .setTitle(R.string.sdcard_permission_dialog_title)



More information about the Android mailing list