[[ Bug 13219 ]] Fix potential crash in OSX locale caching
Merge pull request #1065 from runrevali/bugfix-13219

[[ Bug 13219 ]] Fix potential crash in OSX locale caching