Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Unified Diff: ui/base/l10n/l10n_util.cc

Issue 14230008: Fix CHECK failure in l10n_util::IsLocaleAvailable(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding a TODO comment. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/l10n/l10n_util.cc
diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc
index 86b29802dbda5328321337f145d49d6deb44e8fb..0b7b9b7bcd3b2f2f7a4380f78dc0608d602af1f2 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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698