Skip to content

Commit 512d6e7

Browse files
sebgodclaude
andcommitted
Guard AltitudeChartRenderer against uninitialized PlannerState
When no profile is loaded, PlannerState.AstroDark is default (0001-01-01), causing DateTimeOffset arithmetic to overflow. Now returns early with just the background fill when no data is available. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 83c6f66 commit 512d6e7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/TianWen.UI.Abstractions/AltitudeChartRenderer.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ public static void Render<TSurface>(
7171
var w = (int)renderer.Width;
7272
var h = (int)renderer.Height;
7373

74+
// Guard: no data loaded yet (AstroDark is default = 0001-01-01)
75+
if (state.AstroDark == default)
76+
{
77+
FillRect(renderer, 0, 0, w, h, BackgroundColor);
78+
return;
79+
}
80+
7481
// --- Layout (proportional to renderer size) ---
7582
var xMargin = Math.Max(60, w / 14);
7683
var yMarginTop = Math.Max(36, h / 22);

0 commit comments

Comments
 (0)