Changeset 3257 in josm for trunk/src/org


Ignore:
Timestamp:
2010-05-16T10:55:58+02:00 (14 years ago)
Author:
jttt
Message:

Fix #5032: Unexpected error during PASTE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java

    r3083 r3257  
    1212import javax.swing.tree.MutableTreeNode;
    1313
     14import org.openstreetmap.josm.data.osm.Node;
    1415import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1516import org.openstreetmap.josm.data.osm.PrimitiveData;
     
    3132        }
    3233
     34        // Load nodes first to prevent ways with null coordinates
    3335        for (int i=0; i<createdPrimitives.size(); i++) {
    34             createdPrimitives.get(i).load(data.get(i));
     36            if (createdPrimitives.get(i) instanceof Node) {
     37                createdPrimitives.get(i).load(data.get(i));
     38            }
    3539        }
     40
     41        // Now load ways and relations
     42        for (int i=0; i<createdPrimitives.size(); i++) {
     43            if (!(createdPrimitives.get(i) instanceof Node)) {
     44                createdPrimitives.get(i).load(data.get(i));
     45            }
     46        }
     47
    3648        getLayer().data.setSelected(createdPrimitives);
    3749        return true;
Note: See TracChangeset for help on using the changeset viewer.