summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-08-24 21:02:47 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2016-08-24 21:02:47 (GMT)
commitf293a45e808b444b5a3b8b989b76fdc20566d3c9 (patch)
tree9dae38e1021cbfc880c00f9a43fcc6455d8a3f11
parent047d5b9fc7fe4e1bb04ea1e95c754c6981943c71 (diff)
downloadlibsvgtiny-f293a45e808b444b5a3b8b989b76fdc20566d3c9.tar.gz
libsvgtiny-f293a45e808b444b5a3b8b989b76fdc20566d3c9.tar.bz2
cope with lack of root svg element
-rw-r--r--src/svgtiny.c6
1 files changed, 6 insertions, 0 deletions
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);