From 80843437056afcdf7aa91778c17c31b086642e7f Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 12 Sep 2019 18:06:54 +0200 Subject: [PATCH] guard against a typeError --- rpc.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rpc.js b/rpc.js index c382a275a..f58d59095 100644 --- a/rpc.js +++ b/rpc.js @@ -823,7 +823,12 @@ var resetUserPins = function (Env, publicKey, channelList, cb) { pins[channel] = true; }); - var oldChannels = Object.keys(session.channels); + var oldChannels; + if (session.channels && typeof(session.channels) === 'object') { + oldChannels = Object.keys(session.channels); + } else { + oldChannels = []; + } removePinned(Env, publicKey, oldChannels, () => { addPinned(Env, publicKey, channelList, ()=>{}); });