1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 18:27:43 +00:00

Prevent crash

This commit is contained in:
M66B 2022-04-03 11:43:53 +02:00
parent 55ad97ad4d
commit bfd6b2ac0d

View file

@ -196,7 +196,11 @@ public class FragmentDialogForwardRaw extends FragmentDialogBase {
getArguments().putLongArray("ids", ids); getArguments().putLongArray("ids", ids);
enabled = true; enabled = true;
Button ok = getPositiveButton(); Button ok = getPositiveButton();
if (ok == null)
return;
ok.setEnabled(enabled); ok.setEnabled(enabled);
boolean eml_auto_confirm = prefs.getBoolean("eml_auto_confirm", false); boolean eml_auto_confirm = prefs.getBoolean("eml_auto_confirm", false);
@ -204,7 +208,15 @@ public class FragmentDialogForwardRaw extends FragmentDialogBase {
ok.postDelayed(new Runnable() { ok.postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
getPositiveButton().performClick(); try {
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
return;
Button ok = getPositiveButton();
if (ok != null)
ok.performClick();
} catch (Throwable ex) {
Log.e(ex);
}
} }
}, AUTO_CONFIRM_DELAY); }, AUTO_CONFIRM_DELAY);
} }
@ -239,7 +251,9 @@ public class FragmentDialogForwardRaw extends FragmentDialogBase {
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
getPositiveButton().setEnabled(enabled); Button ok = getPositiveButton();
if (ok != null)
ok.setEnabled(enabled);
} }
private Button getPositiveButton() { private Button getPositiveButton() {