Commit af962ea3 authored by Geoffrey Métais's avatar Geoffrey Métais

Prevent IllegalStateException in permissions fragment

parent 97012710
......@@ -104,10 +104,11 @@ public class StoragePermissionsDelegate extends BaseHeadlessFragment {
}
public static void askStoragePermission(@NonNull FragmentActivity activity) {
if (activity.isFinishing()) return;
final FragmentManager fm = activity.getSupportFragmentManager();
Fragment fragment = fm.findFragmentByTag(TAG);
final Fragment fragment = fm.findFragmentByTag(TAG);
if (fragment == null)
fm.beginTransaction().add(new StoragePermissionsDelegate(), TAG).commit();
fm.beginTransaction().add(new StoragePermissionsDelegate(), TAG).commitAllowingStateLoss();
else
((StoragePermissionsDelegate)fragment).requestStorageAccess();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment