Return NULL for invalid chars

This point will never be reached, thanks to throwing an exception, but
a return value is needed to shut the compiler up