From dad6ca00c02f2f78873a3411cfc40a24a58c5d88 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Wed, 10 Aug 2016 12:48:55 -0700 Subject: [PATCH] Bug 1265262 - Check for null root branch when registering pref watcher. r=froydnj --- xpcom/base/LogModulePrefWatcher.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xpcom/base/LogModulePrefWatcher.cpp b/xpcom/base/LogModulePrefWatcher.cpp index b0920b147466..2903550d8937 100644 --- a/xpcom/base/LogModulePrefWatcher.cpp +++ b/xpcom/base/LogModulePrefWatcher.cpp @@ -51,10 +51,14 @@ LoadPrefValue(const char* aName) void LoadExistingPrefs() { + nsIPrefBranch* root = Preferences::GetRootBranch(); + if (!root) { + return; + } + uint32_t count; char** names; - nsresult rv = Preferences::GetRootBranch()-> - GetChildList(kLoggingPrefPrefix, &count, &names); + nsresult rv = root->GetChildList(kLoggingPrefPrefix, &count, &names); if (NS_SUCCEEDED(rv) && count) { for (size_t i = 0; i < count; i++) { LoadPrefValue(names[i]);