summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-08-24 22:03:31 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2016-08-24 22:03:31 (GMT)
commit2863a608fdf5ce606388e1f36f0e395a17932fed (patch)
tree47b782b9c0e743142a7b64c1b764b76754e70013
parentb9b81b9b8a34f5b3a9069c111c4d7530d73a04ce (diff)
downloadlibdom-2863a608fdf5ce606388e1f36f0e395a17932fed.tar.gz
libdom-2863a608fdf5ce606388e1f36f0e395a17932fed.tar.bz2
fix expat parser adding comment if no node is being constructed
-rw-r--r--bindings/xml/expat_xmlparser.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bindings/xml/expat_xmlparser.c b/bindings/xml/expat_xmlparser.c
index 4bdd5c9..278073c 100644
--- a/bindings/xml/expat_xmlparser.c
+++ b/bindings/xml/expat_xmlparser.c
@@ -359,6 +359,11 @@ expat_xmlparser_comment_handler(void *_parser,
dom_string *data;
dom_exception err;
+ if (parser->current == NULL) {
+ /* not currently building a node so cannot have comment */
+ return;
+ }
+
/* Create DOM string data for comment */
err = dom_string_create((const uint8_t *)_comment,
strlen((const char *) _comment), &data);