From 2538ee19b1edfa68670423b46fd907ed75a7f5f3 Mon Sep 17 00:00:00 2001 From: Benjamin Besse Date: Thu, 12 Dec 2013 14:05:36 +0100 Subject: [PATCH] fix null error if element defs not exist. --- src/svg.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/svg.js b/src/svg.js index 50a5abe..ca62ffa 100644 --- a/src/svg.js +++ b/src/svg.js @@ -1279,7 +1279,8 @@ function getSomeDefs(el) { (el.node.parentNode && wrap(el.node.parentNode)) || Snap.select("svg") || Snap(0, 0), - defs = p.select("defs").node; + pdefs = p.select("defs"), + defs = pdefs == null ? false : pdefs.node; if (!defs) { defs = make("defs", p.node).node; }