Skip to content

Commit

Permalink
Don’t crash when rendering SVGs with non-text a children
Browse files Browse the repository at this point in the history
Related to #2030. Fix #2070.
  • Loading branch information
liZe committed Feb 13, 2024
1 parent b6d07b8 commit 812e194
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion weasyprint/svg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,11 @@ def draw_node(self, node, font_size, fill_stroke=True):
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]
Expand Down

0 comments on commit 812e194

Please sign in to comment.