Skip to content

Commit

Permalink
Don’t crash with unknown gradient types
Browse files Browse the repository at this point in the history
Related to #264.
  • Loading branch information
liZe committed Mar 21, 2020
1 parent 43bd2ff commit 1b3d448
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cairosvg/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ def draw_gradient(surface, node, name, opacity):
fy = size(surface, gradient_node.get('fy', str(cy)), height_ref)
gradient_pattern = cairo.RadialGradient(fx, fy, 0, cx, cy, r)

else:
return False

# Apply matrix to set coordinate system for gradient
if gradient_node.get('gradientUnits') != 'userSpaceOnUse':
gradient_pattern.set_matrix(cairo.Matrix(
Expand Down

0 comments on commit 1b3d448

Please sign in to comment.