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, ()=>{}); });