diff --git a/src/messaging.js b/src/messaging.js index cd3e1f96e2..2cb1fedf1d 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -211,14 +211,14 @@ var db = require('./database'), } }, function(mids, next) { - if (typeof mids !== 'boolean') { + if (typeof mids !== 'boolean' && mids && mids.length) { db.getObjects(['message:' + mids[0], 'message:' + mids[1]], next); } else { next(null, mids); } }, function(messages, next) { - if (typeof messages !== 'boolean') { + if (typeof messages !== 'boolean' && messages && messages.length) { next(null, parseInt(messages[1].timestamp, 10) > parseInt(messages[0].timestamp, 10) + (1000*60*5)); } else { next(null, messages);