Robustness.  Change Segment subclasses to assert segment is not null.
Other changes in the code not to attempt to create null segments:
1) on a reversal in a diagonal.
2) from closing line generator.
Not generate consecutive cusps.
Still BROKEN: still exception on ineffective appendSegment.