소스 검색

Merge pull request #205 from bjorkert/missing-duration

Handling Optional Duration in Basal Data Processing
Jonas Björkert 3 년 전
부모
커밋
4634ec8649
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      LoopFollow/Controllers/NightScout.swift

+ 1 - 1
LoopFollow/Controllers/NightScout.swift

@@ -1319,7 +1319,7 @@ extension MainViewController {
                 priorDateFormatter.timeZone = TimeZone(abbreviation: "UTC")
                 guard let priorDateString = dateFormatter.date(from: priorStrippedZone) else { continue }
                 let priorDateTimeStamp = priorDateString.timeIntervalSince1970
-                let priorDuration = priorEntry?["duration"] as! Double
+                let priorDuration = priorEntry?["duration"] as? Double ?? 0.0
                 // if difference between time stamps is greater than the duration of the last entry, there is a gap. Give a 15 second leeway on the timestamp
                 if Double( dateTimeStamp - priorDateTimeStamp ) > Double( (priorDuration * 60) + 15 ) {