Просмотр исходного кода

Merge pull request #360 from Dmitry-Me/documentConsistencyAsserts

Document consistency asserts
Lee Thomason 10 лет назад
Родитель
Сommit
eb89ef6f0d
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      tinyxml2.h

+ 4 - 0
tinyxml2.h

@@ -630,10 +630,12 @@ public:
 
 
     /// Get the XMLDocument that owns this XMLNode.
     /// Get the XMLDocument that owns this XMLNode.
     const XMLDocument* GetDocument() const	{
     const XMLDocument* GetDocument() const	{
+        TIXMLASSERT( _document );
         return _document;
         return _document;
     }
     }
     /// Get the XMLDocument that owns this XMLNode.
     /// Get the XMLDocument that owns this XMLNode.
     XMLDocument* GetDocument()				{
     XMLDocument* GetDocument()				{
+        TIXMLASSERT( _document );
         return _document;
         return _document;
     }
     }
 
 
@@ -1536,9 +1538,11 @@ public:
     ~XMLDocument();
     ~XMLDocument();
 
 
     virtual XMLDocument* ToDocument()				{
     virtual XMLDocument* ToDocument()				{
+        TIXMLASSERT( this == _document );
         return this;
         return this;
     }
     }
     virtual const XMLDocument* ToDocument() const	{
     virtual const XMLDocument* ToDocument() const	{
+        TIXMLASSERT( this == _document );
         return this;
         return this;
     }
     }