Ignore:
Timestamp:
2014-05-07T15:37:35+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #9988 - NPE in Geometry.getCentroid()

File:
1 edited

Legend:

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

    r7012 r7072  
    701701            EastNorth n1 = nodes.get((i+1) % nodes.size()).getEastNorth();
    702702
    703             if (n0.isValid() && n1.isValid()) {
     703            if (n0 != null && n1 != null && n0.isValid() && n1.isValid()) {
    704704                BigDecimal x0 = new BigDecimal(n0.east());
    705705                BigDecimal y0 = new BigDecimal(n0.north());
     
    727727    /**
    728728     * Compute center of the circle closest to different nodes.
    729      * 
     729     *
    730730     * Ensure exact center computation in case nodes are already aligned in circle.
    731731     * This is done by least square method.
     
    788788        return new EastNorth(xC, yC);
    789789    }
    790    
     790
    791791    /**
    792792     * Returns the coordinate of intersection of segment sp1-sp2 and an altitude
Note: See TracChangeset for help on using the changeset viewer.