Ignore:
Timestamp:
2014-12-19T01:52:29+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #10855 - fix NPE - better handling of nodes without coordinates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r7792 r7828  
    314314    /**
    315315     * Finds the intersection of two lines of infinite length.
    316      * 
     316     *
    317317     * @param p1 first point on first line
    318318     * @param p2 second point on first line
     
    328328        CheckParameterUtil.ensureValidCoordinates(p3, "p3");
    329329        CheckParameterUtil.ensureValidCoordinates(p4, "p4");
    330        
     330
    331331        if (!p1.isValid()) throw new IllegalArgumentException();
    332332
     
    575575        Node oldPoint = polygonNodes.get(polygonNodes.size() - 1);
    576576
     577        if (!oldPoint.isLatLonKnown()) {
     578            return false;
     579        }
     580
    577581        for (Node newPoint : polygonNodes) {
    578582            //skip duplicate points
    579583            if (newPoint.equals(oldPoint)) {
    580584                continue;
     585            }
     586
     587            if (!newPoint.isLatLonKnown()) {
     588                return false;
    581589            }
    582590
     
    733741            result -= 2 * Math.PI;
    734742        }
    735        
     743
    736744        return result;
    737745    }
Note: See TracChangeset for help on using the changeset viewer.