From: Václav Slavík Date: Sat, 16 Jul 2011 10:04:48 +0000 (+0000) Subject: Add check to prevent creation of element wxXmlNodes with content data. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/527d2d2d475cc1d0b441409fdff5b3df68a7e504 Add check to prevent creation of element wxXmlNodes with content data. Just like in the DOM, only text, ctype etc. nodes have textual content, elements don't. See #13297. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68283 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/xml/xml.cpp b/src/xml/xml.cpp index 252331cae0..ee78a9aca4 100644 --- a/src/xml/xml.cpp +++ b/src/xml/xml.cpp @@ -58,6 +58,8 @@ wxXmlNode::wxXmlNode(wxXmlNode *parent,wxXmlNodeType type, m_lineNo(lineNo), m_noConversion(false) { + wxASSERT_MSG ( type != wxXML_ELEMENT_NODE || content.empty(), "element nodes can't have content" ); + if (m_parent) { if (m_parent->m_children) @@ -77,7 +79,9 @@ wxXmlNode::wxXmlNode(wxXmlNodeType type, const wxString& name, m_attrs(NULL), m_parent(NULL), m_children(NULL), m_next(NULL), m_lineNo(lineNo), m_noConversion(false) -{} +{ + wxASSERT_MSG ( type != wxXML_ELEMENT_NODE || content.empty(), "element nodes can't have content" ); +} wxXmlNode::wxXmlNode(const wxXmlNode& node) {