瀏覽代碼

Merge pull request #1100 from nightscout/fix-tidepool-crash

Fix crash in TidepoolManager
Deniz Cengiz 1 月之前
父節點
當前提交
2e69df6f5f
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Trio/Sources/Services/Network/TidepoolManager.swift

+ 2 - 1
Trio/Sources/Services/Network/TidepoolManager.swift

@@ -320,11 +320,12 @@ extension BaseTidepoolManager {
                                     .processTempBasalEvent(event, existingTempBasalEntries: existingTempBasalEntries)
                             )
                     case .bolus:
+                        guard let amount = event.amount else { return result }
                         let bolusDoseEntry = DoseEntry(
                             type: .bolus,
                             startDate: event.timestamp,
                             endDate: event.timestamp,
-                            value: Double(event.amount!),
+                            value: Double(amount),
                             unit: .units,
                             deliveredUnits: nil,
                             syncIdentifier: event.id,