Don't try to parse non-strings

This commit is contained in:
JC Brand 2017-04-23 17:18:00 +00:00
parent c7d66377d0
commit 41edd0567d

View File

@ -457,6 +457,7 @@
} }
utils.getLocale = function (preferred_locale, isSupportedByLibrary) { utils.getLocale = function (preferred_locale, isSupportedByLibrary) {
if (_.isString(preferred_locale)) {
if (preferred_locale === 'en' || isSupportedByLibrary(preferred_locale)) { if (preferred_locale === 'en' || isSupportedByLibrary(preferred_locale)) {
return preferred_locale; return preferred_locale;
} }
@ -466,6 +467,7 @@
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
}
return utils.detectLocale(isSupportedByLibrary) || 'en'; return utils.detectLocale(isSupportedByLibrary) || 'en';
}; };