0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-08 16:18:11 -05:00

Add path parser js impl more resilent to parse errors

This commit is contained in:
Andrey Antukh 2024-01-08 14:58:19 +01:00
parent 36b5ca7313
commit 77472aabea

View file

@ -916,6 +916,7 @@ function simplifyPathData(pdata) {
export function parse(string) {
if (!string || string.length === 0) return [];
try {
var source = new Parser(string);
var result = Array.from(source);
@ -923,4 +924,13 @@ export function parse(string) {
result = simplifyPathData(result);
return result;
} catch (cause) {
const msg = "unexpected exception parsing path";
console.group(msg);
console.log(`string: ${string}`)
console.error(cause);
console.groupEnd(msg);
return [];
}
}