Skip to content

Nightscout entry with eventType missing crashes Loop Follow #165

@gjbadros

Description

@gjbadros

I sent the crash, but also fixed my build trivially. Obviously nightscout events should have eventType set, but mine has legacy data where that invariant doesn't hold so I discovered the problem.

diff --git a/LoopFollow/Controllers/NightScout.swift b/LoopFollow/Controllers/NightScout.swift
index cf15987..b9f8c77 100644
--- a/LoopFollow/Controllers/NightScout.swift
+++ b/LoopFollow/Controllers/NightScout.swift
@@ -990,7 +990,7 @@ extension MainViewController {

         for i in 0..<entries.count {
             let entry = entries[i] as [String : AnyObject]?
-            switch entry?["eventType"] as! String {
+            switch entry?["eventType"] as! String? {
                 case "Temp Basal":
                     tempBasal.append(entry!)
                 case "Correction Bolus":

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions