[Android] Safely exits Runtime Permissions fragment

Geoffrey Métais git at videolan.org
Mon Sep 18 15:40:25 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Sep 18 15:12:50 2017 +0200| [d0ad37490e5ec0ea856cbe4eab9f34ba90932a78] | committer: Geoffrey Métais

Safely exits Runtime Permissions fragment

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

 .../src/org/videolan/vlc/gui/helpers/hf/BaseHeadlessFragment.java      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/hf/BaseHeadlessFragment.java b/vlc-android/src/org/videolan/vlc/gui/helpers/hf/BaseHeadlessFragment.java
index b818e7341..ccbbbc9b0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/hf/BaseHeadlessFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/hf/BaseHeadlessFragment.java
@@ -52,6 +52,7 @@ public class BaseHeadlessFragment extends Fragment {
     }
 
     protected void exit() {
-        mActivity.getSupportFragmentManager().beginTransaction().remove(this).commit();
+        if (mActivity != null && !mActivity.isFinishing())
+            mActivity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss();
     }
 }



More information about the Android mailing list