The method InsertAfterChild() in TinyXml of Kyra 2.0.7
crashes when user tries to insert a new child after the
last child.
The original codes:
TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode*
afterThis, const TiXmlNode& addThis )
{
if ( afterThis->parent != this )
return 0;
TiXmlNode* node = addThis.Clone();
if ( !node )
return 0;
node->parent = this;
node->prev = afterThis;
node->next = afterThis->next;
afterThis->next->prev = node; <--- ERROR!!!
afterThis->next = node;
return node;
}
==============================
The pointed line has to be replaced by:
if( afterThis->next)
afterThis->next->prev = node;
else
lastChild= node;
==============================
I think InsertBeforeChild() has to be fixed accordingly as
well (haven't tried to use it yet)
Phuoc Can HUA