]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
cope with lack of root svg element
authorVincent Sanders <vince@kyllikki.org>
Wed, 24 Aug 2016 21:02:47 +0000 (22:02 +0100)
committerVincent Sanders <vince@kyllikki.org>
Wed, 24 Aug 2016 21:02:47 +0000 (22:02 +0100)
src/svgtiny.c

index e42077a79879eb709a2c3b2258bb1edbf03e6e58..bd9aeaa89486ddc873249744feed390d78042801 100644 (file)
@@ -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);