Fix IllegalStateException (#1585)
Fragment may have detached and does not have parent fragment manager
This commit is contained in:
parent
b4eed403e4
commit
8e6fba6852
|
|
@ -100,18 +100,21 @@ public class CompileDialogFragment extends AppCompatDialogFragment {
|
|||
if (result instanceof UnknownError) {
|
||||
text = context.getString(R.string.compile_failed);
|
||||
} else {
|
||||
text = context.getString(R.string.compile_failed_with_info) + result.toString();
|
||||
text = context.getString(R.string.compile_failed_with_info) + result;
|
||||
}
|
||||
} else {
|
||||
text = context.getString(R.string.compile_done);
|
||||
}
|
||||
CompileDialogFragment fragment = outerRef.get();
|
||||
if (fragment != null) {
|
||||
fragment.dismissAllowingStateLoss();
|
||||
var parent = fragment.getParentFragment();
|
||||
if (parent instanceof BaseFragment) {
|
||||
((BaseFragment) parent).showHint(text, true);
|
||||
try {
|
||||
CompileDialogFragment fragment = outerRef.get();
|
||||
if (fragment != null) {
|
||||
fragment.dismissAllowingStateLoss();
|
||||
var parent = fragment.getParentFragment();
|
||||
if (parent instanceof BaseFragment) {
|
||||
((BaseFragment) parent).showHint(text, true);
|
||||
}
|
||||
}
|
||||
} catch (IllegalStateException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue