Bug 1265262 - Check for null root branch when registering pref watcher. r=froydnj a=lizzard CLOSED TREE
authorEric Rahm <erahm@mozilla.com>
Wed, 10 Aug 2016 12:48:55 -0700
changeset 349716 50153501e96e8cb48d63f09c83ace1a129f3fa73
parent 349715 d8937d3097cb76ac35d8ef62a421b08b6241865c
child 349717 278484d88e6fed51650866356056ac5be03cd885
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj, lizzard
bugs1265262
milestone50.0a2
Bug 1265262 - Check for null root branch when registering pref watcher. r=froydnj a=lizzard CLOSED TREE
xpcom/base/LogModulePrefWatcher.cpp
--- a/xpcom/base/LogModulePrefWatcher.cpp
+++ b/xpcom/base/LogModulePrefWatcher.cpp
@@ -46,20 +46,24 @@ LoadPrefValue(const char* aName)
 
   const char* moduleName = aName + strlen(kLoggingPrefPrefix);
   LogModule::Get(moduleName)->SetLevel(logLevel);
 }
 
 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]);
     }
     NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, names);
   }
 }