From 19caac232b70f8adb17321c04406540044094b0d Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 14 Sep 2016 11:11:00 +0200 Subject: [PATCH] don't try to send invalid messages --- storage/file.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/storage/file.js b/storage/file.js index 00a565863..10adb7894 100644 --- a/storage/file.js +++ b/storage/file.js @@ -74,7 +74,7 @@ var getChannel = function (env, id, callback) { delete env.channels[id]; } whenLoaded.forEach(function (wl) { wl(err, (err) ? undefined : channel); }); - } + }; var path = mkPath(env, id); var fileExists; var errorState; @@ -146,7 +146,15 @@ var getMessages = function (env, chanName, handler, cb) { cb(err); return; } - chan.messages.forEach(handler); + try { + chan.messages + .filter(function (x) { return x; }) + .forEach(handler); + } catch (err2) { + console.error(err2); + cb(err2); + return; + } chan.atime = +new Date(); cb(); });