Skip to content

Glucose Range Picker causes crash using mmol/L and min or max values #1864

Description

@SwiftlyNoah

Describe the bug
When using mmol/L as glucoses units, all instances of GlucoseRangePicker (used to select normal correction range and premeal correction range) share a common bug: when setting the range to the lowest possible value to the lowest possible value OR the highest possible value to the highest possible value the app oftentimes crashes.

To Reproduce
Steps to reproduce the behavior:

  1. Use mmol/L as glucose unit
  2. Adjust correction range to 4.4-4.4 or 10.0-10.0 in either onboarding or settings (likely chance of crash)
  3. Adjust premeal range to 4.4-4.4 or 10.0-10.0 in either onboarding or settings (likely chance of crash)

Expected behavior
The app should accept these values

Phone

  • Simulator, iOS 16.1

Loop Version

  • Current dev workspace (9fd16c2) with the newest LoopKit/LoopKit submodule (7134679)

Why this happens
From brief sleuthing, it appears to be due to a rounding error from mg/dL to mmol/L where the minValue is just higher than the maxValue of the range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions