Skip to content

Commit c0584ec

Browse files
authored
Fix range invariant crasher (#152)
1 parent 705aaec commit c0584ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Loop/Views/DeliveryLimitsEditor.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ struct DeliveryLimitsEditor: View {
110110
let recommendedLowerBound = minimumSupportedBasalRate == 0 ? supportedBasalRates.dropFirst().first! : minimumSupportedBasalRate
111111
let recommendedUpperBound: Double
112112
if let maximumScheduledBasalRate = scheduledBasalRange?.upperBound {
113-
recommendedUpperBound = Self.recommendedMaximumScheduledBasalScaleFactor * maximumScheduledBasalRate
113+
recommendedUpperBound = maximumScheduledBasalRate == 0
114+
? recommendedLowerBound
115+
: Self.recommendedMaximumScheduledBasalScaleFactor * maximumScheduledBasalRate
114116
} else {
115117
recommendedUpperBound = supportedBasalRates.last!
116118
}

0 commit comments

Comments
 (0)