Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aToC() throws on Arc command with rX or rY set to 0 #61

Open
3 tasks done
Kaiido opened this issue Nov 19, 2021 · 0 comments
Open
3 tasks done

aToC() throws on Arc command with rX or rY set to 0 #61

Kaiido opened this issue Nov 19, 2021 · 0 comments

Comments

@Kaiido
Copy link

Kaiido commented Nov 19, 2021

Issue

I'm a gentledev i:

  • fully read the README recently
  • searched for existing issues
  • checked I'm up to date with the latest version of the project

When calling SVGPathData.aToC() on a parsed string with an Arc command that as either rX, rY, or both set to 0, I'd expect that the Arc command is ignored, but currently an Error is thrown.

new SVGPathData("M0 0A80 0 0 0 0 125 125").aToC(); // throws invalid Array length error at mathUtils.ts l.167

The issue is that const partCount = Math.ceil(deltaPhi / 90 ); will be NaN.

A simple fix would be to do something like new Array(partCount || 0);, but it might require more investigation if other invalid values could make it there as well (e.g Infinity?).

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

No branches or pull requests

1 participant