From: Vincent Sanders Date: Wed, 24 Aug 2016 21:02:47 +0000 (+0100) Subject: cope with lack of root svg element X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=f293a45e808b444b5a3b8b989b76fdc20566d3c9;p=libsvgtiny.git cope with lack of root svg element --- diff --git a/src/svgtiny.c b/src/svgtiny.c index e42077a..bd9aeaa 100644 --- a/src/svgtiny.c +++ b/src/svgtiny.c @@ -188,6 +188,12 @@ svgtiny_code svgtiny_parse(struct svgtiny_diagram *diagram, dom_node_unref(document); return svgtiny_LIBDOM_ERROR; } + if (svg == NULL) { + /* no root svg element */ + dom_node_unref(document); + return svgtiny_SVG_ERROR; + } + exc = dom_node_get_node_name(svg, &svg_name); if (exc != DOM_NO_ERR) { dom_node_unref(svg);