From 2d0b63d5cd0579d1c2aef0694ed6624edc288fb2 Mon Sep 17 00:00:00 2001 From: Jordi Sala Morales Date: Tue, 8 Oct 2024 11:27:32 +0200 Subject: [PATCH] Fix vector network error on invalid access to the property (#225) * Fix vector network error on invalid access to the property * Add changeset --- .changeset/rare-trees-peel.md | 5 +++++ plugin-src/transformers/partials/transformVectorPaths.ts | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .changeset/rare-trees-peel.md diff --git a/.changeset/rare-trees-peel.md b/.changeset/rare-trees-peel.md new file mode 100644 index 0000000..95006e3 --- /dev/null +++ b/.changeset/rare-trees-peel.md @@ -0,0 +1,5 @@ +--- +"penpot-exporter": patch +--- + +Fix vector network error on invalid access to the property diff --git a/plugin-src/transformers/partials/transformVectorPaths.ts b/plugin-src/transformers/partials/transformVectorPaths.ts index f02e3b5..740a549 100644 --- a/plugin-src/transformers/partials/transformVectorPaths.ts +++ b/plugin-src/transformers/partials/transformVectorPaths.ts @@ -14,7 +14,14 @@ import { translateCommands, translateWindingRule } from '@plugin/translators/vec import { PathShape } from '@ui/lib/types/shapes/pathShape'; export const transformVectorPaths = (node: VectorNode): PathShape[] => { - const regions = node.vectorNetwork?.regions ?? []; + let regions: readonly VectorRegion[] = []; + + try { + regions = node.vectorNetwork?.regions ?? []; + } catch (error) { + console.error('Error accessing vector network', node, error); + } + const strokeLength = node.strokes.length; const pathShapes = node.vectorPaths