diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java index 1baac9a694..6ac7d13cfa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java @@ -107,9 +107,9 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL @Override public void onPause() { + running = false; super.onPause(); MainApp.unsubscribe(this); - running = false; if (L.isEnabled(L.UI)) log.debug("onPause"); } @@ -173,10 +173,12 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL Activity activity = getActivity(); if (activity != null) { activity.runOnUiThread(() -> { - if (L.isEnabled(L.UI)) - log.debug("executing"); try { - dismiss(); + if (running) { + if (L.isEnabled(L.UI)) + log.debug("executing"); + dismiss(); + } } catch (Exception e) { log.error("Unhandled exception", e); }