Changeset 1941 in josm


Ignore:
Timestamp:
2009-08-09T22:43:59+02:00 (11 years ago)
Author:
stoecker
Message:

fixed NPE

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r1751 r1941  
    6767                                target="1.5" source="1.5" debug="on" encoding="UTF-8">
    6868                        <compilerarg value="-Xlint:deprecation"/>
     69                        <compilerarg value="-Xlint:unchecked"/>
    6970                </javac>
    7071        </target>
     
    103104                                target="1.5" source="1.5" debug="on" encoding="UTF-8">
    104105                        <compilerarg value="-Xlint:deprecation"/>
     106                        <compilerarg value="-Xlint:unchecked"/>
    105107                </javac>
    106108        </target>
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r1908 r1941  
    292292        double minDistanceSq = snapDistance;
    293293        Node minPrimitive = null;
    294         for (Node n : getCurrentDataSet().nodes) {
     294        DataSet ds = getCurrentDataSet();
     295        if(ds == null)
     296            return null;
     297        for (Node n : ds.nodes) {
    295298            if (n.deleted || n.incomplete) {
    296299                continue;
     
    320323    public final List<WaySegment> getNearestWaySegments(Point p) {
    321324        TreeMap<Double, List<WaySegment>> nearest = new TreeMap<Double, List<WaySegment>>();
    322         for (Way w : getCurrentDataSet().ways) {
     325        DataSet ds = getCurrentDataSet();
     326        if(ds == null)
     327            return null;
     328        for (Way w : ds.ways) {
    323329            if (w.deleted || w.incomplete) {
    324330                continue;
     
    376382    public final WaySegment getNearestWaySegment(Point p, Collection<WaySegment> ignore) {
    377383        List<WaySegment> nearest = getNearestWaySegments(p);
     384        if(nearest == null)
     385            return null;
    378386        if (ignore != null) {
    379387            nearest.removeAll(ignore);
     
    439447    public Collection<OsmPrimitive> getAllNearest(Point p) {
    440448        Collection<OsmPrimitive> nearest = new HashSet<OsmPrimitive>();
    441         for (Way w : getCurrentDataSet().ways) {
     449        DataSet ds = getCurrentDataSet();
     450        if(ds == null)
     451            return null;
     452        for (Way w : ds.ways) {
    442453            if (w.deleted || w.incomplete) {
    443454                continue;
     
    465476            }
    466477        }
    467         for (Node n : getCurrentDataSet().nodes) {
     478        for (Node n : ds.nodes) {
    468479            if (!n.deleted && !n.incomplete
    469480                    && getPoint(n).distanceSq(p) < snapDistance) {
     
    484495    public Collection<Node> getNearestNodes(Point p) {
    485496        Collection<Node> nearest = new HashSet<Node>();
    486         for (Node n : getCurrentDataSet().nodes) {
     497        DataSet ds = getCurrentDataSet();
     498        if(ds == null)
     499            return null;
     500        for (Node n : ds.nodes) {
    487501            if (!n.deleted && !n.incomplete
    488502                    && getPoint(n).distanceSq(p) < snapDistance) {
Note: See TracChangeset for help on using the changeset viewer.