-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Scenario
The test Nightscout site I'm using had no data for 10 days after being previously used with LoopFollow.
LoopFollow began to crash when I started it again and began to populate the NS site with data
- the Loop data is uploaded from a test phone
- the glucose data is uploaded using a shell script from my computer
- (Note that I had quit LoopFollow in the interim, when not testing it.)
Crash
Built LoopFollow with Xcode so I could find the crash:
- fatal error index out of range for LoopFollow/Controllers/Alarms.swift, line 246 (lines 245 and 246 shown)
let persistentHighReadings = Int(UserDefaultsRepository.alertHighPersistent.value / 5)
let persistentHighBG = bgData[bgData.count - 1 - persistentHighReadings].sgv
printed out some values:
- bgData.count = 6
- persistentHighReadings = 12
leading to the index out of range
Bandaid fix
- modified line 245 to prevent index out of range. Let it run and there were no more crashes.
let persistentHighReadings = min(Int(UserDefaultsRepository.alertHighPersistent.value / 5), bgData.count-1)
let persistentHighBG = bgData[bgData.count - 1 - persistentHighReadings].sgv
Metadata
Metadata
Assignees
Labels
No labels