Ignore:
Timestamp:
2009-08-10T13:05:59+02:00 (15 years ago)
Author:
stoecker
Message:

fixed josm 2965 - patch by dmuecke - Array Bounds

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/waydownloader/src/WayDownloaderPlugin.java

    r16962 r16963  
    177177    /** See if there's another node at the same coordinates. If so return it. Otherwise null */
    178178    private Node duplicateNode() {
    179         for (Node onNode:Main.main.getCurrentDataSet().nodes) {
     179        for (Node onNode:Main.main.getCurrentDataSet().nodes) {
    180180            if (!onNode.equals(this.selectedNode)
    181                         && !onNode.incomplete
     181                    && !onNode.incomplete
    182182                    && onNode.getCoor().lat()==selectedNode.getCoor().lat()
    183183                    && onNode.getCoor().lon()==selectedNode.getCoor().lon()) {
     
    217217    private boolean workFromWaySelection(Collection<OsmPrimitive> selection) {
    218218
    219         if (selection.size()>1) {
    220             //more than one way selected
     219        if (selection.size() != 1)
    221220            return false;
    222         } else {
    223             Way selectedWay = (Way) selection.toArray()[0];
    224             selectedNode = selectedWay.firstNode();
    225 
    226             if (isDownloaded(selectedNode)) {
    227                 selectedNode = findOtherEnd(selectedWay, selectedNode);
    228 
    229                 if (isDownloaded(selectedNode)) return false;
    230             }
     221        Way selectedWay = (Way) selection.iterator().next();
     222        selectedNode = selectedWay.firstNode();
     223
     224        if (isDownloaded(selectedNode)) {
     225            selectedNode = selectedWay.lastNode();
     226
     227            if (isDownloaded(selectedNode)) return false;
    231228        }
    232229        Main.main.getCurrentDataSet().setSelected(selectedNode);
Note: See TracChangeset for help on using the changeset viewer.