testscreenings - actually the angle function returns error if any of the 2 vectors is 0, so it cancels the script and makes it not work in such cases. Something like remove doubles would work too I suppose.
For the f-curves it actually can happen, if automerge of keyframes is off.
if edge1.length>0 and edge2.length>0: # this means if both of the vectors are non 0 it runs the angle function, so also for only 2 points on same location it goes to the else statement. But It was just a quick hack to make it work, I had an example curve where that happened(from greasepencil, there it can happen I gues quite often), and the script worked ok after that, although it probably didn’t remove those conflicting points correctly, because of ridiculous value for the angle - 180. This value I did put in because I supposed that in the case of a flat angle, one of the points gets removed.
by the way, I still wonder how well such short script works with the curves(both types), and it’s a really great feature I did some animating overnight, using the recording feature, and the resulting curves behaved well after the simplification.