Fix bug in piecewise continuity checker.

When asked to check continuity at the start of a segment, the routine
would instead check at the end of that segment.  This often gave wrong
results, or would run off the end of the piecewise curve and cause
a segfault.

It is most likely that the linked-list based piecewise curve never came
to this code path due to differences in its find_segment routine.