Changeset 17164 in josm


Ignore:
Timestamp:
2020-10-11T15:46:53+02:00 (2 weeks ago)
Author:
Don-vip
Message:

fix #19772 - NPE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r17110 r17164  
    828828            showConfirmMoveDialog(ed);
    829829        }
    830         final int moveCount = UndoRedoHandler.getInstance().getLastCommand().getParticipatingPrimitives().size();
    831         if (UndoRedoHandler.getInstance().getLastCommand() instanceof MoveCommand) {
    832             final double moveDistance = ((MoveCommand) UndoRedoHandler.getInstance().getLastCommand()).getDistance(n -> !n.isNew());
     830        final Command lastCommand = UndoRedoHandler.getInstance().getLastCommand();
     831        if (lastCommand == null) {
     832            Logging.warn("No command found in undo/redo history, skipping confirmOrUndoMovement");
     833            return;
     834        }
     835        final int moveCount = lastCommand.getParticipatingPrimitives().size();
     836        if (lastCommand instanceof MoveCommand) {
     837            final double moveDistance = ((MoveCommand) lastCommand).getDistance(n -> !n.isNew());
    833838            if (Double.isFinite(moveDistance) && moveDistance > Config.getPref().getInt("warn.move.maxdistance", 200)) {
    834839                final ConfirmMoveDialog ed = new ConfirmMoveDialog();
Note: See TracChangeset for help on using the changeset viewer.