Merge pull request #561 from Dmitry-Me/unlinkedElementsAssertions

Unlinked nodes assertions
This commit is contained in:
Lee Thomason 2017-06-15 10:29:07 -07:00 committed by GitHub
commit 275067a91f
2 changed files with 3 additions and 2 deletions

View File

@ -1994,6 +1994,7 @@ XMLDocument::~XMLDocument()
void XMLDocument::MarkInUse(XMLNode* node) void XMLDocument::MarkInUse(XMLNode* node)
{ {
TIXMLASSERT(node);
TIXMLASSERT(node->_parent == 0); TIXMLASSERT(node->_parent == 0);
for (int i = 0; i < _unlinked.Size(); ++i) { for (int i = 0; i < _unlinked.Size(); ++i) {

View File

@ -265,8 +265,8 @@ public:
} }
void SwapRemove(int i) { void SwapRemove(int i) {
TIXMLASSERT(i >= 0); TIXMLASSERT(i >= 0 && i < _size);
TIXMLASSERT(i < _size); TIXMLASSERT(_size > 0);
_mem[i] = _mem[_size - 1]; _mem[i] = _mem[_size - 1];
--_size; --_size;
} }