diff --git a/xdrip/Storyboards/Base.lproj/Main.storyboard b/xdrip/Storyboards/Base.lproj/Main.storyboard
index 498e82071..ef1b18313 100644
--- a/xdrip/Storyboards/Base.lproj/Main.storyboard
+++ b/xdrip/Storyboards/Base.lproj/Main.storyboard
@@ -162,41 +162,41 @@
-
+
-
+
-
+
-
-
+
+
-
-
+
diff --git a/xdrip/View Controllers/Treatments/TreatmentsInsertViewController.swift b/xdrip/View Controllers/Treatments/TreatmentsInsertViewController.swift
index 6e7e37ea6..89a04829b 100644
--- a/xdrip/View Controllers/Treatments/TreatmentsInsertViewController.swift
+++ b/xdrip/View Controllers/Treatments/TreatmentsInsertViewController.swift
@@ -175,20 +175,25 @@ class TreatmentsInsertViewController : UIViewController {
UserDefaults.standard.nightScoutSyncTreatmentsRequired = true
}
-
- } else {
- // text is nil or "0", set treatmentdeleted to true
- treatMentEntryToUpdate.treatmentdeleted = true
+ } else {
- // set uploaded to false so that the entry is synced with NightScout
- treatMentEntryToUpdate.uploaded = false
-
- // trigger nightscoutsync
- UserDefaults.standard.nightScoutSyncTreatmentsRequired = true
+ // even though there is not a valid/useable number entered, only delete the treatment if the user has really changed it to zero. If they didn't enter zero then just disregard the input.
+ if let text = textField.text, let value = Double(text.replacingOccurrences(of: ",", with: ".")), value == 0 {
+
+ // text is nil or "0", set treatmentdeleted to true
+ treatMentEntryToUpdate.treatmentdeleted = true
+
+ // set uploaded to false so that the entry is synced with NightScout
+ treatMentEntryToUpdate.uploaded = false
+
+ // trigger nightscoutsync
+ UserDefaults.standard.nightScoutSyncTreatmentsRequired = true
+
+ self.treatMentEntryToUpdate = nil
+
+ }
- self.treatMentEntryToUpdate = nil
-
}
}