From 1b3d44858b0338abfbe5ba01de8ce2faf5177967 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sat, 21 Mar 2020 21:36:39 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20crash=20with=20unknown=20gradie?= =?UTF-8?q?nt=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to #264. --- cairosvg/defs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cairosvg/defs.py b/cairosvg/defs.py index 36ee4a68..6e12e5b3 100644 --- a/cairosvg/defs.py +++ b/cairosvg/defs.py @@ -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(