Guard against missing members in setObjectMembers

This commit is contained in:
Kevin Sawicki 2016-11-15 09:44:41 -08:00
parent cb0845fc49
commit 5167ccd147

View file

@ -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, {