From c2f677b05edf9a12c7591645d4d5ea8dc7cf3e4b Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 15 Jun 2017 12:44:27 +0300 Subject: [PATCH] Unlinked nodes assertions --- tinyxml2.cpp | 1 + tinyxml2.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 3182c5a..99b5e92 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -1994,6 +1994,7 @@ XMLDocument::~XMLDocument() void XMLDocument::MarkInUse(XMLNode* node) { + TIXMLASSERT(node); TIXMLASSERT(node->_parent == 0); for (int i = 0; i < _unlinked.Size(); ++i) { diff --git a/tinyxml2.h b/tinyxml2.h index 864c8b9..fd7f6b4 100755 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -265,8 +265,8 @@ public: } void SwapRemove(int i) { - TIXMLASSERT(i >= 0); - TIXMLASSERT(i < _size); + TIXMLASSERT(i >= 0 && i < _size); + TIXMLASSERT(_size > 0); _mem[i] = _mem[_size - 1]; --_size; }