1
0
Fork 0

Fix SVG parser crash on unsupported <defs> element.

This commit is contained in:
Henning Stahlke 2021-02-14 13:01:18 +01:00
parent 411ac4a0a8
commit b791ead702

View file

@ -422,7 +422,7 @@ var parsesvg = func(group, path, options = nil)
{ {
append(defs_stack, {'type': name, 'id': attr['id']}); append(defs_stack, {'type': name, 'id': attr['id']});
} }
else if( name == "rect" ) else if( ishash(defs_stack[-1]) and name == "rect" )
{ {
foreach(var p; ["x", "y", "width", "height"]) foreach(var p; ["x", "y", "width", "height"])
defs_stack[-1][p] = evalCSSNum(attr[p]); defs_stack[-1][p] = evalCSSNum(attr[p]);