From: Václav Slavík Date: Mon, 28 May 2001 10:37:11 +0000 (+0000) Subject: fixed parsing of comments before root node X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/66080691b195b1b338a21c8887323b2e073d6028 fixed parsing of comments before root node git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/contrib/src/xml/xmlexpat.cpp b/contrib/src/xml/xmlexpat.cpp index 358d45a05b..206973a4a9 100644 --- a/contrib/src/xml/xmlexpat.cpp +++ b/contrib/src/xml/xmlexpat.cpp @@ -132,8 +132,14 @@ static void CommentHnd(void *userData, const char *data) { wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData; - ctx->node->AddChild(new wxXmlNode(wxXML_COMMENT_NODE, - wxT("comment"), CharToString(data))); + if (ctx->node) + { + // VS: ctx->node == NULL happens if there is a comment before + // the root element (e.g. wxDesigner's output). We ignore such + // comments, no big deal... + ctx->node->AddChild(new wxXmlNode(wxXML_COMMENT_NODE, + wxT("comment"), CharToString(data))); + } ctx->lastAsText = NULL; }