Add check for user in cros settings handler

BUG=341969
R=nkostylev@chromium.org

Review URL: https://codereview.chromium.org/169993002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251871 0039d316-1c4b-4281-b951-d872f2087c98
parent 9918a75e
...@@ -255,11 +255,13 @@ void CoreChromeOSOptionsHandler::GetLocalizedValues( ...@@ -255,11 +255,13 @@ void CoreChromeOSOptionsHandler::GetLocalizedValues(
AddAccountUITweaksLocalizedValues(localized_strings, profile); AddAccountUITweaksLocalizedValues(localized_strings, profile);
UserManager* user_manager = UserManager::Get(); UserManager* user_manager = UserManager::Get();
const std::string& primary_email = user_manager->GetPrimaryUser()->email();
// Check at load time whether this is a secondary user in a multi-profile // Check at load time whether this is a secondary user in a multi-profile
// session. // session.
if (user_manager->GetUserByProfile(profile)->email() != primary_email) { User* user = user_manager->GetUserByProfile(profile);
if (user && user->email() != user_manager->GetPrimaryUser()->email()) {
const std::string& primary_email = user_manager->GetPrimaryUser()->email();
// Set secondaryUser to show the shared icon by the network section header. // Set secondaryUser to show the shared icon by the network section header.
localized_strings->SetBoolean("secondaryUser", true); localized_strings->SetBoolean("secondaryUser", true);
localized_strings->SetString("secondaryUserBannerText", localized_strings->SetString("secondaryUserBannerText",
......
...@@ -394,8 +394,8 @@ void CrosLanguageOptionsHandler::SetApplicationLocale( ...@@ -394,8 +394,8 @@ void CrosLanguageOptionsHandler::SetApplicationLocale(
UserManager* user_manager = UserManager::Get(); UserManager* user_manager = UserManager::Get();
// Only the primary user can change the locale. // Only the primary user can change the locale.
if (user_manager->GetUserByProfile(profile)->email() == User* user = user_manager->GetUserByProfile(profile);
user_manager->GetPrimaryUser()->email()) { if (user && user->email() == user_manager->GetPrimaryUser()->email()) {
profile->ChangeAppLocale(language_code, profile->ChangeAppLocale(language_code,
Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); Profile::APP_LOCALE_CHANGED_VIA_SETTINGS);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment