From a3dc427e671ce8af059a8ceb85fe99192f41544e Mon Sep 17 00:00:00 2001 From: barisusakli <barisusakli@gmail.com> Date: Mon, 21 Dec 2015 15:40:53 +0200 Subject: [PATCH] if there are no messages pass empty array --- src/messaging.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/messaging.js b/src/messaging.js index b560bbb989..444dfb2496 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -151,7 +151,7 @@ var async = require('async'), }); next(undefined, messages); - } else { + } else if (messages.length === 1) { // For single messages, we don't know the context, so look up the previous message and compare var key = 'uid:' + uid + ':chat:room:' + roomId + ':mids'; async.waterfall([ @@ -183,6 +183,8 @@ var async = require('async'), next(undefined, messages); }); + } else { + next(null, []); } } ], callback);