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

Side by Side Diff: ios/chrome/browser/ui/settings/sync_settings_collection_view_controller.mm

Issue 2854303003: Don't crash when having an update from an unknown identity (Closed)
Patch Set: :( Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/ui/settings/sync_settings_collection_view_controller .h" 5 #import "ios/chrome/browser/ui/settings/sync_settings_collection_view_controller .h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 [self stopBrowserStateServiceObservers]; 957 [self stopBrowserStateServiceObservers];
958 [_authenticationFlow cancelAndDismiss]; 958 [_authenticationFlow cancelAndDismiss];
959 } 959 }
960 960
961 #pragma mark - ChromeIdentityServiceObserver 961 #pragma mark - ChromeIdentityServiceObserver
962 962
963 - (void)onProfileUpdate:(ChromeIdentity*)identity { 963 - (void)onProfileUpdate:(ChromeIdentity*)identity {
964 CollectionViewAccountItem* item = 964 CollectionViewAccountItem* item =
965 base::mac::ObjCCastStrict<CollectionViewAccountItem>( 965 base::mac::ObjCCastStrict<CollectionViewAccountItem>(
966 [_identityMap objectForKey:identity.gaiaID]); 966 [_identityMap objectForKey:identity.gaiaID]);
967 if (!item) {
968 // Ignoring unknown identity.
969 return;
970 }
967 [self updateAccountItem:item withIdentity:identity]; 971 [self updateAccountItem:item withIdentity:identity];
968 [self reconfigureCellsForItems:@[ item ] 972 [self reconfigureCellsForItems:@[ item ]
969 inSectionWithIdentifier:SectionIdentifierSyncAccounts]; 973 inSectionWithIdentifier:SectionIdentifierSyncAccounts];
970 } 974 }
971 975
972 - (void)onChromeIdentityServiceWillBeDestroyed { 976 - (void)onChromeIdentityServiceWillBeDestroyed {
973 _identityServiceObserver.reset(); 977 _identityServiceObserver.reset();
974 } 978 }
975 979
976 @end 980 @end
OLDNEW
« 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