GeometryGraph.insertBoundaryPoint NULL label check
Brought to you by:
dr_jts
GeometryGraph#insertBoundaryPoint checks the node label for being null only once, but uses it twice:
private void insertBoundaryPoint(int argIndex, Coordinate coord)
{
Node n = nodes.addNode(coord);
Label lbl = n.getLabel();
// the new point to insert is on a boundary
int boundaryCount = 1;
// determine the current location for the point (if any)
int loc = Location.NONE;
if (lbl != null) loc = lbl.getLocation(argIndex, Position.ON);
if (loc == Location.BOUNDARY) boundaryCount++;
// determine the boundary status of the point according to the Boundary Determination Rule
int newLoc = determineBoundary(boundaryNodeRule, boundaryCount);
lbl.setLocation(argIndex, newLoc);
}
Nodes always have labels, so null check is not required. Removed