Fix crash when string is empty