Protect the undo/redo system from exceptions.