1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-09-11 20:47:56 +03:00

Don’t crash when rendering SVGs with non-text a children

Related to #2030. Fix #2070.
This commit is contained in:
Guillaume Ayoub 2024-02-13 22:36:45 +01:00
parent b6d07b8ced
commit 812e1946ec

View File

@ -464,7 +464,11 @@ class SVG:
if node.display and node.tag not in DEF_TYPES:
for child in node:
self.draw_node(child, font_size, fill_stroke)
if TAGS.get(node.tag) == text and child.visible:
visible_text_child = (
TAGS.get(node.tag) == text and
TAGS.get(child.tag) == text and
child.visible)
if visible_text_child:
if not is_valid_bounding_box(child.text_bounding_box):
continue
x1, y1 = child.text_bounding_box[:2]