Changeset 13189 in josm


Ignore:
Timestamp:
2017-12-03T16:31:30+01:00 (8 days ago)
Author:
Don-vip
Message:

sonar - squid:S2259 - Null pointers should not be dereferenced

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
2 edited

Legend:

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

    r13173 r13189  
    297297        Set<Node> allNodes = new HashSet<>(nodes);
    298298        allNodes.add(targetLocationNode);
    299         return mergeNodes(nodes, selectTargetNode(allNodes), targetLocationNode);
     299        Node targetNode = selectTargetNode(allNodes);
     300        if (targetNode == null) {
     301            return null;
     302        }
     303        return mergeNodes(nodes, targetNode, targetLocationNode);
    300304    }
    301305
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r13062 r13189  
    719719                    if (ll != null && ll.isOutSideWorld()) {
    720720                        // Revert move
    721                         ((MoveCommand) c).resetToCheckpoint();
     721                        if (c instanceof MoveCommand) {
     722                            ((MoveCommand) c).resetToCheckpoint();
     723                        }
    722724                        // TODO: We might use a simple notification in the lower left corner.
    723725                        JOptionPane.showMessageDialog(
Note: See TracChangeset for help on using the changeset viewer.