Open bcwhite-code opened 1 year ago
Here's the fix I'm running locally:
diff --git a/svgpathtools/svg_to_paths.py b/svgpathtools/svg_to_paths.py
index 6211e6f..108cd98 100644
--- a/svgpathtools/svg_to_paths.py
+++ b/svgpathtools/svg_to_paths.py
@@ -62,6 +62,7 @@ def polyline2pathd(polyline, is_polygon=False):
else:
points = COORD_PAIR_TMPLT.findall(polyline.get('points', ''))
+ if not points or len(points) < 2: return ""
closed = (float(points[0][0]) == float(points[-1][0]) and
float(points[0][1]) == float(points[-1][1]))
I don't know why Inkscape is writing empty polygon strings (points=""
).
I found the offending svg line:
<polygon
class="st21"
points=""
id="polygon476939" />
No idea what it is in the UI.
Got this error today trying to read a huge (33MiB) SVG Inkscape export.
I've no idea on what path it choked but you might want to consider putting a guard on the
points
array that is returned to make sure that it actually contains something.