Prevent crash

pull/209/head
M66B 3 years ago
parent 9c759e310f
commit a1d45a2684

@ -197,13 +197,21 @@ public class FragmentDialogBase extends DialogFragment {
if (!hasResult || resultCode == RESULT_OK) {
hasResult = true;
if (targetRequestKey != null) {
if (targetRequestKey != null)
try {
Bundle args = getArguments();
if (args == null) // onDismiss
args = new Bundle();
args.putInt("requestCode", targetRequestCode);
args.putInt("resultCode", resultCode);
getParentFragmentManager().setFragmentResult(targetRequestKey, args);
} catch (Throwable ex) {
Log.w(ex);
/*
java.lang.IllegalStateException: Fragment FragmentDialog... not associated with a fragment manager.
at androidx.fragment.app.Fragment.getParentFragmentManager(SourceFile:2)
at eu.faircode.email.FragmentDialogBase.sendResult(SourceFile:9)
*/
}
}
}

Loading…
Cancel
Save