From 023846628d7f75384da98174ad19704629238f3e Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Tue, 3 Mar 2015 16:02:13 +0300 Subject: [PATCH] Add and make use of pre- and post-asserts in XMLDocument::Identify() --- tinyxml2.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index a9948cf..46f5f7f 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -515,6 +515,8 @@ bool XMLUtil::ToDouble( const char* str, double* value ) char* XMLDocument::Identify( char* p, XMLNode** node ) { + TIXMLASSERT( node ); + TIXMLASSERT( p ); char* const start = p; p = XMLUtil::SkipWhiteSpace( p ); if( !*p ) { @@ -577,6 +579,8 @@ char* XMLDocument::Identify( char* p, XMLNode** node ) p = start; // Back it up, all the text counts. } + TIXMLASSERT( returnNode ); + TIXMLASSERT( p ); *node = returnNode; return p; } @@ -844,9 +848,6 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEnd ) XMLNode* node = 0; p = _document->Identify( p, &node ); - if ( p == 0 || node == 0 ) { - break; - } StrPair endTag; p = node->ParseDeep( p, &endTag );