[Android] Cancel permission request if fragment is detached

Geoffrey Métais git at videolan.org
Wed Mar 13 11:11:26 CET 2019


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

Cancel permission request if fragment is detached

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

 .../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