Commit 5ec96ead authored by Anastasiia Nikolaienko's avatar Anastasiia Nikolaienko Committed by Commit Bot

Check service for null in GetMessagesForAvatarSyncError

Bug: 989849
Change-Id: Id3d68e7fadae8a87722169900fe91b865448af02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1732091
Commit-Queue: Anastasiia Nikolaienko <anastasiian@chromium.org>
Reviewed-by: default avatarKush Sinha <sinhak@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683536}
parent ac90f55c
......@@ -260,12 +260,16 @@ AvatarSyncErrorType GetMessagesForAvatarSyncError(
const syncer::SyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile);
// If there is no SyncService (probably because sync is disabled from the
// command line), then there's no error to show.
if (!service)
return NO_SYNC_ERROR;
// The order or priority is going to be: 1. Unrecoverable errors.
// 2. Auth errors. 3. Outdated client errors. 4. Passphrase errors.
// Note that an unrecoverable error is sometimes caused by the Chrome client
// being outdated; that case is handled separately below.
if (service && service->HasUnrecoverableError() &&
!service->RequiresClientUpgrade()) {
if (service->HasUnrecoverableError() && !service->RequiresClientUpgrade()) {
// Display different messages and buttons for managed accounts.
if (!signin_util::IsUserSignoutAllowedForProfile(profile)) {
// For a managed user, the user is directed to the signout
......@@ -294,28 +298,25 @@ AvatarSyncErrorType GetMessagesForAvatarSyncError(
return AUTH_ERROR;
}
// Check for sync errors if the sync service is enabled.
if (service) {
// Check if the Chrome client needs to be updated.
if (service->RequiresClientUpgrade()) {
*content_string_id = IDS_SYNC_ERROR_USER_MENU_UPGRADE_MESSAGE;
*button_string_id = IDS_SYNC_ERROR_USER_MENU_UPGRADE_BUTTON;
return UPGRADE_CLIENT_ERROR;
}
// Check if the Chrome client needs to be updated.
if (service->RequiresClientUpgrade()) {
*content_string_id = IDS_SYNC_ERROR_USER_MENU_UPGRADE_MESSAGE;
*button_string_id = IDS_SYNC_ERROR_USER_MENU_UPGRADE_BUTTON;
return UPGRADE_CLIENT_ERROR;
}
// Check for a sync passphrase error.
if (ShouldShowPassphraseError(service)) {
*content_string_id = IDS_SYNC_ERROR_USER_MENU_PASSPHRASE_MESSAGE;
*button_string_id = IDS_SYNC_ERROR_USER_MENU_PASSPHRASE_BUTTON;
return PASSPHRASE_ERROR;
}
// Check for a sync passphrase error.
if (ShouldShowPassphraseError(service)) {
*content_string_id = IDS_SYNC_ERROR_USER_MENU_PASSPHRASE_MESSAGE;
*button_string_id = IDS_SYNC_ERROR_USER_MENU_PASSPHRASE_BUTTON;
return PASSPHRASE_ERROR;
}
// Check for a sync confirmation error.
if (ShouldRequestSyncConfirmation(service)) {
*content_string_id = IDS_SYNC_SETTINGS_NOT_CONFIRMED;
*button_string_id = IDS_SYNC_ERROR_USER_MENU_CONFIRM_SYNC_SETTINGS_BUTTON;
return SETTINGS_UNCONFIRMED_ERROR;
}
// Check for a sync confirmation error.
if (ShouldRequestSyncConfirmation(service)) {
*content_string_id = IDS_SYNC_SETTINGS_NOT_CONFIRMED;
*button_string_id = IDS_SYNC_ERROR_USER_MENU_CONFIRM_SYNC_SETTINGS_BUTTON;
return SETTINGS_UNCONFIRMED_ERROR;
}
// There is no error.
......
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