Fix crash when undoing more doing

--cursorUndoIndex_ will be -1 if it is equal to 0