Defend against various internal errors with object notation
These changes simply allow us to bail out of the whole method when an inappropriate input is detected. Otherwise, the functions might cause errors like `Cannot call method 'hasOwnProperty' of undefined`.
The above case can happen when, for example, there's a syntax error in a locale .json file.
Merge pull request #129 from oliversalzburg/fix/defensive-on

Defend against various internal errors with object notation