libspiro improvements to prevent crashes and segfaults

Various error checks and cleanups. Resulting code is a bit more robust against possible problems when drawing spiros. Should also resolve issue https://github.com/fontforge/libspiro/issues/4