Skip to content

fix(core,common): guard NaN from malformed geometry data - #1168

Open
HandsomeButterball wants to merge 2 commits into
developfrom
fix/nan-geometry-guards
Open

HandsomeButterball wants to merge 2 commits into
developfrom
fix/nan-geometry-guards

Conversation

@HandsomeButterball

@HandsomeButterball HandsomeButterball commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • 防护历史脏几何(残缺 connection、零向量、坏 path 点)在渲染/导出时产生 NaN
  • 影响 @plait/core、@plait/common;合法数据行为不变
  • 非法 connection 分量回落 0.5(形心/边中点)

Test plan

  • 打开此前 NaN 的脏数据画板,确认可展示并可导出
  • 正常绘制/编辑不受影响
  • 发版后 wiki 升级 @plait/* 再回归

Prevent export/render crashes when historical connection points or zero vectors produce non-finite coordinates.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Deploying plait with  Cloudflare Pages  Cloudflare Pages

Latest commit: dfdc00b
Status:🚫  Build failed.

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Deploying plait-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: dfdc00b
Status:🚫  Build failed.

View logs

…port

Bounding boxes built from non-finite geometry produce a 0×0 canvas and
canvas.toDataURL silently returns 'data:,' instead of an image. Skip the
export when the computed size is invalid, and ignore non-finite points in
drawLine/drawLinearPath so rendering stays intact.

This branch has not been deployed

No deployments
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