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

Unified Diff: chrome/browser/ui/webui/settings/people_handler.cc

Issue 2598073002: MD Settings: Fix policy-related ProfileSyncService crashes. (Closed)
Patch Set: Created 4 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/ui/webui/settings/people_handler.cc
diff --git a/chrome/browser/ui/webui/settings/people_handler.cc b/chrome/browser/ui/webui/settings/people_handler.cc
index d31837e724734edb75fc6eb5fa96ba0c62f84fb4..2fcfd1e1dcfd3070ee6ecd731baeef814351ee44 100644
--- a/chrome/browser/ui/webui/settings/people_handler.cc
+++ b/chrome/browser/ui/webui/settings/people_handler.cc
@@ -775,7 +775,10 @@ void PeopleHandler::PushSyncPrefs() {
return;
ProfileSyncService* service = GetSyncService();
- DCHECK(service);
+ // The sync service may be nullptr if it has been just disabled by policy.
+ if (!service)
+ return;
+
if (!service->IsEngineInitialized()) {
// Requesting the sync service to start may trigger another reentrant call
// to PushSyncPrefs. Setting up the startup tracker beforehand correctly
@@ -903,8 +906,8 @@ void PeopleHandler::MarkFirstSetupComplete() {
signin::SetUserSkippedPromo(profile_);
ProfileSyncService* service = GetSyncService();
- DCHECK(service);
- if (service->IsFirstSetupComplete())
+ // The sync service may be nullptr if it has been just disabled by policy.
+ if (!service || service->IsFirstSetupComplete())
Dan Beam 2016/12/22 22:07:40 nit: is there somehow we can check that if !servic
tommycli 2016/12/22 22:46:16 Well... it's more like, GetSyncService() returns n
return;
// This is the first time configuring sync, so log it.
« 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