diff options
author | hshi@chromium.org <hshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-16 22:12:49 +0000 |
---|---|---|
committer | hshi@chromium.org <hshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-16 22:12:49 +0000 |
commit | 6cb2087e66fb6c89c8b5decf861a11853d6185d2 (patch) | |
tree | 5b1fd5f80c47b7510a655a324da10e400df86505 /ui | |
parent | 39ee80094317fbf2432578e4e024bb23a2ee7ef1 (diff) | |
download | chromium_src-6cb2087e66fb6c89c8b5decf861a11853d6185d2.zip chromium_src-6cb2087e66fb6c89c8b5decf861a11853d6185d2.tar.gz chromium_src-6cb2087e66fb6c89c8b5decf861a11853d6185d2.tar.bz2 |
Fix CHECK failure in l10n_util::IsLocaleAvailable().
If the ResourceBundle is not yet initialized, l10n_util::IsLocaleAvailable() should
return false to avoid the CHECK failure in ResourceBundle::GetSharedInstance().
BUG=230432
TEST=CQ
Review URL: https://codereview.chromium.org/14230008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194463 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/l10n/l10n_util.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc index 86b29802..0b7b9b7 100644 --- a/ui/base/l10n/l10n_util.cc +++ b/ui/base/l10n/l10n_util.cc @@ -246,6 +246,14 @@ bool IsLocaleAvailable(const std::string& locale) { if (!l10n_util::IsLocaleSupportedByOS(locale)) return false; + // If the ResourceBundle is not yet initialized, return false to avoid the + // CHECK failure in ResourceBundle::GetSharedInstance(). + if (!ResourceBundle::HasSharedInstance()) + return false; + + // TODO(hshi): make ResourceBundle::LocaleDataPakExists() a static function + // so that this can be invoked without initializing the global instance. + // See crbug.com/230432: CHECK failure in GetUserDataDir(). return ResourceBundle::GetSharedInstance().LocaleDataPakExists(locale); } |