Changeset 6215 in josm for trunk/src/org


Ignore:
Timestamp:
2013-09-04T00:37:59+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #9042 - Robustness to invalid .osm files containing null coordinates

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

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

    r6202 r6215  
    3737import org.openstreetmap.josm.command.SequenceCommand;
    3838import org.openstreetmap.josm.data.coor.EastNorth;
     39import org.openstreetmap.josm.data.coor.LatLon;
    3940import org.openstreetmap.josm.data.osm.DataSet;
    4041import org.openstreetmap.josm.data.osm.Node;
     
    698699            }
    699700            for (Node n : affectedNodes) {
    700                 if (n.getCoor().isOutSideWorld()) {
     701                LatLon ll = n.getCoor();
     702                if (ll != null && ll.isOutSideWorld()) {
    701703                    // Revert move
    702704                    ((MoveCommand) c).resetToCheckpoint();
  • trunk/src/org/openstreetmap/josm/command/MoveCommand.java

    r6173 r6215  
    151151        for (Node n : nodes) {
    152152            OldNodeState os = it.next();
    153             n.setEastNorth(os.eastNorth.add(x, y));
     153            if (os.eastNorth != null) {
     154                n.setEastNorth(os.eastNorth.add(x, y));
     155            }
    154156        }
    155157    }
     
    160162            if (n == null)
    161163                throw new AssertionError("null detected in node list");
    162             if (n.getEastNorth() == null)
    163                 throw new AssertionError("null coordinates detected in node list");
    164 
    165             n.setEastNorth(n.getEastNorth().add(x, y));
    166             n.setModified(true);
     164            EastNorth en = n.getEastNorth();
     165            if (en != null) {
     166                n.setEastNorth(en.add(x, y));
     167                n.setModified(true);
     168            }
    167169        }
    168170        return true;
  • trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java

    r6140 r6215  
    267267            throw new IllegalStateException(tr("Cannot assign a changesetId > 0 to a new primitive. Value of changesetId is {0}", changesetId));
    268268
    269         int old = this.changesetId;
    270269        this.changesetId = changesetId;
    271270    }
     
    716715     * @param key the key forming the tag.
    717716     * @param values one or many values forming the tag.
    718      * @return true iff primitive contains a tag consisting of {@code key} and any of {@code values}.
     717     * @return true if primitive contains a tag consisting of {@code key} and any of {@code values}.
    719718     */
    720719    public boolean hasTag(String key, String... values) {
Note: See TracChangeset for help on using the changeset viewer.