Commit eaa12c7b authored by ahest's avatar ahest Committed by Commit bot

Fix crash on chrome://sync-internals when sync is disabled.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#293330}
parent 347e5643
......@@ -95,14 +95,15 @@ void SyncInternalsMessageHandler::HandleRegisterForPerTypeCounters(
const base::ListValue* args) {
DCHECK(args->empty());
ProfileSyncService* service = GetProfileSyncService();
if (service && !is_registered_for_counters_) {
service->AddTypeDebugInfoObserver(this);
is_registered_for_counters_ = true;
} else {
// Re-register to ensure counters get re-emitted.
service->RemoveTypeDebugInfoObserver(this);
service->AddTypeDebugInfoObserver(this);
if (ProfileSyncService* service = GetProfileSyncService()) {
if (!is_registered_for_counters_) {
service->AddTypeDebugInfoObserver(this);
is_registered_for_counters_ = true;
} else {
// Re-register to ensure counters get re-emitted.
service->RemoveTypeDebugInfoObserver(this);
service->AddTypeDebugInfoObserver(this);
}
}
}
......
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