Blame SOURCES/0002-objectManager-handle-object-manager-sending-empty-ar.patch

f3cbb9
From 9ce09f7afb08a32eff1f6664d7893c49237a45c7 Mon Sep 17 00:00:00 2001
f3cbb9
From: Ray Strode <rstrode@redhat.com>
f3cbb9
Date: Wed, 14 Jun 2017 16:41:41 -0400
f3cbb9
Subject: [PATCH 2/2] objectManager: handle object manager sending empty array
f3cbb9
f3cbb9
If the service implementing the object manager returns
f3cbb9
a 0 length array we currently throw an exception.
f3cbb9
f3cbb9
This commit fixes that.
f3cbb9
---
f3cbb9
 js/misc/objectManager.js | 5 +++++
f3cbb9
 1 file changed, 5 insertions(+)
f3cbb9
f3cbb9
diff --git a/js/misc/objectManager.js b/js/misc/objectManager.js
f3cbb9
index 5db7588b6..835057f5e 100644
f3cbb9
--- a/js/misc/objectManager.js
f3cbb9
+++ b/js/misc/objectManager.js
f3cbb9
@@ -181,60 +181,65 @@ const ObjectManager = new Lang.Class({
f3cbb9
 
f3cbb9
         if (Object.keys(this._interfaceInfos).length == 0) {
f3cbb9
             this._tryToCompleteLoad();
f3cbb9
             return;
f3cbb9
         }
f3cbb9
 
f3cbb9
         this._managerProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
f3cbb9
             if (this._managerProxy.g_name_owner)
f3cbb9
                 this._onNameAppeared();
f3cbb9
             else
f3cbb9
                 this._onNameVanished();
f3cbb9
         }));
f3cbb9
 
f3cbb9
         if (this._managerProxy.g_name_owner)
f3cbb9
             this._onNameAppeared();
f3cbb9
     },
f3cbb9
 
f3cbb9
     _onNameAppeared: function() {
f3cbb9
         this._managerProxy.GetManagedObjectsRemote(Lang.bind(this, function(result, error) {
f3cbb9
             if (!result) {
f3cbb9
                 if (error) {
f3cbb9
                    logError(error, 'could not get remote objects for service ' + this._serviceName + ' path ' + this._managerPath);
f3cbb9
                 }
f3cbb9
 
f3cbb9
                 this._tryToCompleteLoad();
f3cbb9
                 return;
f3cbb9
             }
f3cbb9
 
f3cbb9
             let [objects] = result;
f3cbb9
 
f3cbb9
+            if (!objects) {
f3cbb9
+                this._tryToCompleteLoad();
f3cbb9
+                return;
f3cbb9
+            }
f3cbb9
+
f3cbb9
             let objectPaths = Object.keys(objects);
f3cbb9
             for (let i = 0; i < objectPaths.length; i++) {
f3cbb9
                 let objectPath = objectPaths[i];
f3cbb9
                 let object = objects[objectPath];
f3cbb9
 
f3cbb9
                 let interfaceNames = Object.getOwnPropertyNames(object);
f3cbb9
                 for (let j = 0; j < interfaceNames.length; j++) {
f3cbb9
                     let interfaceName = interfaceNames[j];
f3cbb9
 
f3cbb9
                     // Prevent load from completing until the interface is loaded
f3cbb9
                     this._numLoadInhibitors++;
f3cbb9
                     this._addInterface(objectPath,
f3cbb9
                                        interfaceName,
f3cbb9
                                        Lang.bind(this, this._tryToCompleteLoad));
f3cbb9
                 }
f3cbb9
             }
f3cbb9
             this._tryToCompleteLoad();
f3cbb9
         }));
f3cbb9
     },
f3cbb9
 
f3cbb9
     _onNameVanished: function() {
f3cbb9
         let objectPaths = Object.keys(this._objects);
f3cbb9
         for (let i = 0; i < objectPaths.length; i++) {
f3cbb9
             let object = this._objects[objectPaths];
f3cbb9
 
f3cbb9
             let interfaceNames = Object.keys(object);
f3cbb9
             for (let j = 0; i < interfaceNames.length; i++) {
f3cbb9
                 let interfaceName = interfaceNames[i];
f3cbb9
 
f3cbb9
                 if (object[interfaceName])
f3cbb9
-- 
f3cbb9
2.13.0
f3cbb9