Skip to content

fix: Prevent app crash while moving presets#540

Merged
ps2 merged 1 commit into
LoopKit:devfrom
bastiaanv:fix/app-crash-override
Aug 21, 2024
Merged

fix: Prevent app crash while moving presets#540
ps2 merged 1 commit into
LoopKit:devfrom
bastiaanv:fix/app-crash-override

Conversation

@bastiaanv

Copy link
Copy Markdown
Contributor

Screen recording of crash:

https://github.com/user-attachments/assets/500ebf9a-6bbc-4884-9a47-c9faf9b66a4b
Screenshot 2024-08-18 at 20 24 10

Reported by @bedtime4bonzos (LoopKit/Loop#2210)

Proposed fix

It feels like this wasn't an issue until the override history was added. But the fix is to check what the greater allowed index is, and everything above it to cap at the original index

@bastiaanv

Copy link
Copy Markdown
Contributor Author

Ping @ps2 & @marionbarker

@marionbarker

Copy link
Copy Markdown
Contributor

Status

Success

Test

  • Without the patch, dragging an override below the History row crashes the app.
  • After applying the patch, dragging an override below the History row positions it as the last override (above the Custom and History rows).

@ps2 ps2 merged commit 3ce43de into LoopKit:dev Aug 21, 2024
dnzxy pushed a commit to dnzxy/LoopKit that referenced this pull request Oct 1, 2024
* fixing the dismissable view

* remove unneeded text
loopkitdev pushed a commit to loopkitdev/LoopKit that referenced this pull request Mar 12, 2026
Resolved 16 conflicts across 15 files + project.pbxproj:

Kept DIY (protect inline algorithm / active UI):
- LoopKit/LoopAlgorithm/LoopAlgorithm.swift: kept (DIY inline; fix: correct < vs > in precondition msg)
- LoopKit/LoopAlgorithm/LoopPredictionOutput.swift: kept (DIY inline; fix: wrong CodingKey for predictedGlucose)
- LoopKit/InsulinKit/ExponentialInsulinModel.swift: kept (DIY inline; fix: missing closing paren in debugDescription)
- LoopKitUI/View Controllers/OverrideSelectionViewController.swift: kept (DIY Loop still depends on it; crash fix LoopKit#540)

Took Tidepool's:
- LoopKitUI/Views/GlucoseValuePicker.swift: selectableValues now caller-provided (cleaner API)
- LoopKitUI/Extensions/QuantityFormatter+Guardrails.swift: HKQuantity → LoopQuantity
- LoopKitTests/AlertTests.swift: specific JSON encoding assertions
- LoopKitTests/GuardrailTests.swift: LoopQuantity, new maxSuspendThreshold API
- LoopKitTests/DoseStoreTests.swift: async DoseStore init, new API
- LoopKit/InsulinKit/DoseStore.swift: improved async addPumpEvents logging
- .circleci/config.yml: Xcode 26.1.1, iPhone 17 destination

Manual merges (best of both):
- LoopKit/Extensions/Guardrail+Settings.swift: LoopQuantity types + Tidepool's cleaner bounds
- LoopKit/QuantityFormatter.swift: LoopUnit (Tidepool) + DIY's rule: parameter preserved
- LoopKitUI/Views/Information Screens/GlucoseTherapySettingInformationView.swift:
  Tidepool's LoopQuantity API + preserved DIY's workoutCorrectionRangeOverride case
- MockKitUI/Views/MockCGMManagerSettingsView.swift: kept both heartbeatSubSection (Tidepool)
  and settingsSubSection (DIY debug features)
- LoopKit.xcodeproj/project.pbxproj: merged all file refs from both sides;
  deployment target 15.1 → 17.0 (Tidepool); preserved LOCALIZATION_PREFERS_STRING_CATALOGS

See sync-docs/LoopKit.md for full context and testing notes.
loopkitdev added a commit to loopkitdev/LoopKit that referenced this pull request Mar 12, 2026
Resolved 16 conflicts across 15 files + project.pbxproj:

Kept DIY (protect inline algorithm / active UI):
- LoopKit/LoopAlgorithm/LoopAlgorithm.swift: kept (DIY inline; fix: correct < vs > in precondition msg)
- LoopKit/LoopAlgorithm/LoopPredictionOutput.swift: kept (DIY inline; fix: wrong CodingKey for predictedGlucose)
- LoopKit/InsulinKit/ExponentialInsulinModel.swift: kept (DIY inline; fix: missing closing paren in debugDescription)
- LoopKitUI/View Controllers/OverrideSelectionViewController.swift: kept (DIY Loop still depends on it; crash fix LoopKit#540)

Took Tidepool's:
- LoopKitUI/Views/GlucoseValuePicker.swift: selectableValues now caller-provided (cleaner API)
- LoopKitUI/Extensions/QuantityFormatter+Guardrails.swift: HKQuantity → LoopQuantity
- LoopKitTests/AlertTests.swift: specific JSON encoding assertions
- LoopKitTests/GuardrailTests.swift: LoopQuantity, new maxSuspendThreshold API
- LoopKitTests/DoseStoreTests.swift: async DoseStore init, new API
- LoopKit/InsulinKit/DoseStore.swift: improved async addPumpEvents logging
- .circleci/config.yml: Xcode 26.1.1, iPhone 17 destination

Manual merges (best of both):
- LoopKit/Extensions/Guardrail+Settings.swift: LoopQuantity types + Tidepool's cleaner bounds
- LoopKit/QuantityFormatter.swift: LoopUnit (Tidepool) + DIY's rule: parameter preserved
- LoopKitUI/Views/Information Screens/GlucoseTherapySettingInformationView.swift:
  Tidepool's LoopQuantity API + preserved DIY's workoutCorrectionRangeOverride case
- MockKitUI/Views/MockCGMManagerSettingsView.swift: kept both heartbeatSubSection (Tidepool)
  and settingsSubSection (DIY debug features)
- LoopKit.xcodeproj/project.pbxproj: merged all file refs from both sides;
  deployment target 15.1 → 17.0 (Tidepool); preserved LOCALIZATION_PREFERS_STRING_CATALOGS

See sync-docs/LoopKit.md for full context and testing notes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants