Changeset 17342 in josm


Ignore:
Timestamp:
2020-11-23T20:52:54+01:00 (3 months ago)
Author:
GerdP
Message:

fix #20098: Corrupted undo/redo stack after unsuccesful undo

  • Keep undo/redo stack intact if Command.undo() throws Execption
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java

    r16568 r17342  
    378378                for (int i = 1; i <= num; ++i) {
    379379                    final Command c = commands.removeLast();
    380                     c.undoCommand();
     380                    try {
     381                        c.undoCommand();
     382                    } catch (Exception e) { // NOPMD
     383                        // fix #20098: restore command stack as we will not fire an event
     384                        commands.add(c);
     385                        throw e;
     386                    }
    381387                    redoCommands.addFirst(c);
    382388                    fireEvent(new CommandUndoneEvent(this, c));
Note: See TracChangeset for help on using the changeset viewer.