Small bug in XmlElement.cpp


This is in the ‘insertChildElement()’ function.

When inserting at 0, it works fine (0 becomes home for the new element, and the rest are all bumped up one).

When inserting at any other point though, the insertion actually happens one step too high. For example, inserting at 1 will actually place it third (index 2). Currently the algorithm finds the element it should replace, and then sets the new one to be its next element instead.

The fix is simple:

833:           while (child->nextElement != 0 && --indexToInsertAt > 0)
// previously: while (child->nextElement != 0 && --indexToInsertAt >= 0)


Gosh, I wonder how that one slipped through the net… Thanks, old chap, I’ll get it fixed!