From 02369b952b8c233ca6598fe3bd5b38505b09d618 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Tue, 10 Oct 2017 22:54:24 +0200 Subject: [PATCH] a little safer< --- .../Dialogs/NewNSTreatmentDialog.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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")); } }); }