Skip to content

Fix DonutChart infinite loop with null-valued entries in LeftAndRight label mode - #379

Merged
follesoe merged 1 commit into
mainfrom
fix/donut-leftright-null-hang
Jul 21, 2026
Merged

follesoe merged 1 commit into
mainfrom
fix/donut-leftright-null-hang

Conversation

@follesoe

Copy link
Copy Markdown
Contributor

Summary

DonutChart.DrawCaptionLeftAndRight (the default LeftAndRight label mode) skipped null-valued entries with continue without advancing the loop index, so any DonutChart that contained a null-valued entry and used the default label mode would spin forever — an app hang. The fix advances the index before the skip in both the right-side and left-side split loops, so i always progresses.

Verification

Reproduced and fixed with a headless SkiaSharp render (a donut with a null-valued entry, default LeftAndRight mode):

  • Before: chart.Draw(...) never returned — killed by a 12s watchdog.
  • After: renders and returns immediately.

Context: the originally-reported issue #124 ("5 labels, last one dropped") turned out to be already fixed; this hang is a separate defect found while investigating it.

🤖 Generated with Claude Code

DrawCaptionLeftAndRight skipped null-valued entries with `continue` without
advancing the loop index, so a DonutChart that had any null-valued entry and
used the default LeftAndRight label mode would spin forever (app hang).
Advance the index before the skip in both the right-side and left-side split
loops.

Verified with a headless render: a donut with a null-valued entry in the
default label mode previously hung (killed after 12s) and now renders.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@follesoe follesoe added the bug label Jul 21, 2026
@follesoe follesoe self-assigned this Jul 21, 2026
@follesoe follesoe added this to the v2.0.0 milestone Jul 21, 2026
@follesoe
follesoe merged commit c61d4b8 into main Jul 21, 2026
2 checks passed
@follesoe
follesoe deleted the fix/donut-leftright-null-hang branch July 21, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant