diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java index 1b9de2acf9..73cc0d9d10 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java @@ -733,17 +733,19 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick profileSwitch.isCPP = percentage != 100 || timeshift != 0; profileSwitch.timeshift = timeshift; profileSwitch.percentage = percentage; - } - MainApp.getConfigBuilder().addToHistoryProfileSwitch(profileSwitch); + MainApp.getConfigBuilder().addToHistoryProfileSwitch(profileSwitch); - PumpInterface pump = MainApp.getConfigBuilder(); - if (pump != null) { - pump.setNewBasalProfile(profileSwitch.getProfileObject()); - MainApp.bus().post(new EventNewBasalProfile()); + PumpInterface pump = MainApp.getConfigBuilder(); + if (pump != null) { + pump.setNewBasalProfile(profileSwitch.getProfileObject()); + MainApp.bus().post(new EventNewBasalProfile()); + } else { + log.error("No active pump selected"); + } + Answers.getInstance().logCustom(new CustomEvent("ProfileSwitch")); } else { - log.error("No active pump selected"); + log.error("No profile switch existing"); } - Answers.getInstance().logCustom(new CustomEvent("ProfileSwitch")); } }); }