getObjectsFix

return empty array if keys is empty or not an array
v1.18.x
barisusakli 11 years ago
parent 39392672a2
commit 515e663f85

@ -32,7 +32,7 @@ module.exports = function(db, module) {
module.getObjects = function(keys, callback) {
if (!Array.isArray(keys) || !keys.length) {
return callback();
return callback(null, []);
}
db.collection('objects').find({_key: {$in: keys}}, {_id: 0}).toArray(function(err, data) {
if(err) {

@ -40,6 +40,10 @@ var async = require('async'),
return callback(err);
}
if (!Array.isArray(notifications) || !notifications.length) {
return callback(null, []);
}
async.map(notifications, function(notification, next) {
if (!notification) {
return next(null, null);

Loading…
Cancel
Save