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

Unified Diff: chrome/browser/chromeos/login/language_switch_menu.cc

Issue 5939002: Error handling added (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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: chrome/browser/chromeos/login/language_switch_menu.cc
diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc
index c18d20da42d4925457a8c879dde0b1c298a28df1..36101b6aa7a8b3d3818d5669c8d9324cc11a9cf8 100644
--- a/chrome/browser/chromeos/login/language_switch_menu.cc
+++ b/chrome/browser/chromeos/login/language_switch_menu.cc
@@ -67,8 +67,13 @@ void LanguageSwitchMenu::InitLanguageMenu() {
std::wstring LanguageSwitchMenu::GetCurrentLocaleName() const {
DCHECK(g_browser_process);
const std::string locale = g_browser_process->GetApplicationLocale();
- return language_list_->GetLanguageNameAt(
- language_list_->GetIndexFromLocale(locale));
+ int index = language_list_->GetIndexFromLocale(locale);
+ if (index == -1) {
+ // If locale cannot be found (probably user edited prefs file
Nikita (slow) 2010/12/16 15:28:49 I'm not sure that in the original crash users were
+ // manually) - use the default.
+ index = 0;
Nikita (slow) 2010/12/16 15:28:49 Default locale (0) is always en-US?
+ }
+ return language_list_->GetLanguageNameAt(index);
};
void LanguageSwitchMenu::SetFirstLevelMenuWidth(int width) {
« 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