Fix crash when passed an empty string.
Add a test for empty input strings to go with #4