From 5167ccd1478a906a0a84ebfa630c65a189fcfa4f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 15 Nov 2016 09:44:41 -0800 Subject: [PATCH] Guard against missing members in setObjectMembers --- lib/renderer/api/remote.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/renderer/api/remote.js b/lib/renderer/api/remote.js index 3cb99e5b9d65..be0b71af6d9e 100644 --- a/lib/renderer/api/remote.js +++ b/lib/renderer/api/remote.js @@ -95,6 +95,8 @@ const wrapArgs = function (args, visited) { // The |ref| will be kept referenced by |members|. // This matches |getObjectMemebers| in rpc-server. const setObjectMembers = function (ref, object, metaId, members) { + if (!Array.isArray(members)) return + for (let member of members) { if (object.hasOwnProperty(member.name)) continue @@ -161,9 +163,7 @@ const proxyFunctionProperties = function (remoteMemberFunction, metaId, name) { if (loaded) return loaded = true const meta = ipcRenderer.sendSync('ELECTRON_BROWSER_MEMBER_GET', metaId, name) - if (Array.isArray(meta.members)) { - setObjectMembers(remoteMemberFunction, remoteMemberFunction, meta.id, meta.members) - } + setObjectMembers(remoteMemberFunction, remoteMemberFunction, meta.id, meta.members) } return new Proxy(remoteMemberFunction, {