BUG: fix uninitialized-use on invalid sort kind

orign is unset at that point but used in the fail goto,
can probably only be triggered by using the C-api wrong.
Merge pull request #3456 from juliantaylor/uninitialized-use

BUG: fix uninitialized-use on invalid sort kind