Skip to content

fix(svg): drop SVG icon layers with no drawing segment#193

Merged
DemchaAV merged 1 commit into
developfrom
fix/svg-icon-drop-empty-layers
Jun 14, 2026
Merged

fix(svg): drop SVG icon layers with no drawing segment#193
DemchaAV merged 1 commit into
developfrom
fix/svg-icon-drop-empty-layers

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Why

A visible-painted SVG element that lowers to a moveto-only or moveto+close path — d="M12 12", a zero-length arc, the stray subpaths real exporters emit — draws no ink, yet on develop:

  • a lone moveto threw at SvgIcon#node(...) (it builds an empty PathNode), failing the whole icon;
  • a moveto+close rendered a blank layer.

One degenerate element from a messy exporter should not break the rest of the icon.

What

  • SvgPath gains a package-private hasDrawingSegment() (true when a LineTo/CubicTo is present).
  • SvgIconReader.emitLayer drops a layer whose geometry has no drawing segment, so a degenerate element contributes nothing instead of breaking the icon.
  • An icon composed only of such elements still fails loudly via the existing layers.isEmpty() → "no drawable geometry" guard.

Tests

SvgIconTest: a stray moveto-only + moveto+close alongside a real box → only the box survives and node(...) builds (it threw before); a degenerate-only icon fails with "no drawable geometry". Full suite 1380 green.

Lane: canonical document.svg (@beta reader robustness).

A visible-painted SVG element that lowers to a moveto-only or moveto+close
path (d="M12 12", a zero-length arc, the stray subpaths exporters emit)
draws no ink, yet a lone moveto threw at SvgIcon#node(...) building an empty
PathNode and a moveto+close rendered blank. SvgIconReader.emitLayer now
drops a layer whose geometry has no LineTo/CubicTo (new package-private
SvgPath.hasDrawingSegment()), so one degenerate element no longer fails the
whole icon. An icon of only such elements still fails loudly via the
existing 'no drawable geometry' guard.

Adds two SvgIconTest cases. Full suite green (1380).
@DemchaAV DemchaAV merged commit 058b79b into develop Jun 14, 2026
11 checks passed
@DemchaAV DemchaAV deleted the fix/svg-icon-drop-empty-layers branch June 14, 2026 17:22
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