meerk40t / svgelements

SVG Parsing for Elements, Paths, and other SVG Objects.
MIT License
124 stars 28 forks source link

Delayed path parsing, for partial paths can be None. #245

Open tatarize opened 4 months ago

tatarize commented 4 months ago

Delayed path parsing for partial paths could relay None data and cause a crash.

tatarize commented 4 months ago

May be fixed with:

    def parse(self, parser, pathd):
        if pathd is None:
            return
dojoe commented 2 months ago

Just happened to me - apparently Inkscape uses special attributes for arcs instead of a d attribute:

    <path
       style="fill:#ff9955;stroke-width:4.00000007;stroke:#ff0000"
       id="path8"
       sodipodi:type="arc"
       sodipodi:cx="828.69006"
       sodipodi:cy="522.49927"
       sodipodi:rx="89.827477"
       sodipodi:ry="92.376137"
       sodipodi:start="0"
       sodipodi:end="1.9988103"
       sodipodi:open="true"
       sodipodi:arc-type="arc" />

My fix was to make sure the None gets turned into an empty string - that gets rid of the crash but of course the path is empty. Long term I'm thinking about parsing those sodipodi attributes into a proper Arc.