Skip to content
Snippets Groups Projects
Commit af962ea3 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Prevent IllegalStateException in permissions fragment

parent 97012710
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment