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

Unified Diff: chrome/browser/ui/webui/sync_internals_message_handler.cc

Issue 537893002: Fix crash on chrome://sync-internals when sync is disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 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/sync_internals_message_handler.cc
diff --git a/chrome/browser/ui/webui/sync_internals_message_handler.cc b/chrome/browser/ui/webui/sync_internals_message_handler.cc
index 92ff657baf0cf0914c63b2a9d859fae3d3f52640..fa21977522d44848d523aafb291e376b59c966f7 100644
--- a/chrome/browser/ui/webui/sync_internals_message_handler.cc
+++ b/chrome/browser/ui/webui/sync_internals_message_handler.cc
@@ -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);
+ }
}
}
« 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