Prevent NPE in LineDissolver on zero-length edge
Brought to you by:
dr_jts
When adding a line with a zero-length first edge the LineDissolver throws a NullPointerException at line 111.
This simple patch prevents the NPE:
private void add(LineString lineString) {
if (factory == null) {
this.factory = lineString.getFactory();
}
CoordinateSequence seq = lineString.getCoordinateSequence();
boolean first = true;
for (int i = 1; i < seq.size(); i++) {
DissolveHalfEdge e = (DissolveHalfEdge) graph.addEdge(seq.getCoordinate(i-1), seq.getCoordinate(i));
/*
* Record source initial segments, so that they can be reflected in output when needed
* (i.e. during formation of isolated rings)
/
if (e != null && first) {
e.setStart();
first = false;
}
}
}