From 2863a608fdf5ce606388e1f36f0e395a17932fed Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 24 Aug 2016 23:03:31 +0100 Subject: fix expat parser adding comment if no node is being constructed --- bindings/xml/expat_xmlparser.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bindings/xml/expat_xmlparser.c b/bindings/xml/expat_xmlparser.c index 4bdd5c9d..278073c0 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); -- cgit v1.2.1