Updated to not throw exceptions.

Crashing an app is not warranted in this situation. Exceptions should really be reserved for...exceptional...cases where continuing the program would be a futile effort.

If an invalid string is passed in, just return `nil`.