Fix crash when element is being inserted "after itself"
This commit is contained in:
@@ -911,6 +911,13 @@ XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis )
|
||||
TIXMLASSERT( false );
|
||||
return 0;
|
||||
}
|
||||
if ( afterThis == addThis ) {
|
||||
// Current state: BeforeThis -> AddThis -> OneAfterAddThis
|
||||
// Now AddThis must disappear from it's location and then
|
||||
// reappear between BeforeThis and OneAfterAddThis.
|
||||
// So just leave it where it is.
|
||||
return addThis;
|
||||
}
|
||||
|
||||
if ( afterThis->_next == 0 ) {
|
||||
// The last node or the only node.
|
||||
|
||||
Reference in New Issue
Block a user