Skip to content

Feature/color temperature row crash guard#1133

Merged
timbms merged 4 commits intodevelopfrom
feature/color-temperature-row-crash-guard
Apr 8, 2026
Merged

Feature/color temperature row crash guard#1133
timbms merged 4 commits intodevelopfrom
feature/color-temperature-row-crash-guard

Conversation

@timbms
Copy link
Copy Markdown
Contributor

@timbms timbms commented Apr 8, 2026

There is bug reported via Crashlytics:

Summary

  • Guard against NaN propagation in CustomSliderView when minValue == maxValue produces a zero-span range, causing .position(x: NaN) to crash SwiftUI's layout engine during preferredLayoutAttributesFitting
  • Replace stride(from:through:by: 0) in gradient generation with an integer-step approach safe for zero spans
  • Extract all temperature math into a pure, testable ColorTemperatureRowMath enum with unit tests covering degenerate range, mired conversion, server value fallback, and fraction clamping

Test plan

  • ColorTemperatureRowMathTests passes (normalizedRange fallback, mired conversion, server value fallback, degenerate fraction, gradient bounds)
  • Color temperature row renders correctly for normal Kelvin ranges
  • Color temperature row renders correctly for mired-unit ranges (e.g. min=370, max=153)
  • No crash when a widget reports identical min and max temperature values

timbms and others added 4 commits April 7, 2026 21:52
Guard against NaN propagation when min/max temperature values produce
a zero-span range. Extract math into testable ColorTemperatureRowMath
and replace stride-based gradient generation with an integer-step
approach that is safe when the span is zero.

Signed-off-by: Tim Mueller-Seydlitz <timbms@gmail.com>
Signed-off-by: Tim Mueller-Seydlitz <timbms@gmail.com>
@timbms timbms merged commit 04c17f5 into develop Apr 8, 2026
2 checks passed
@timbms timbms deleted the feature/color-temperature-row-crash-guard branch April 8, 2026 22:08
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.

1 participant