error check

v1.18.x
barisusakli 10 years ago
parent b89b960f86
commit a6e498bb5d

@ -141,8 +141,14 @@ var async = require('async'),
}; };
Groups.search = function(query, options, callback) { Groups.search = function(query, options, callback) {
if (query.length) { if (!query) {
return callback(null, []);
}
db.getSetMembers('groups', function(err, groups) { db.getSetMembers('groups', function(err, groups) {
if (err) {
return callback(err);
}
groups = groups.filter(function(groupName) { groups = groups.filter(function(groupName) {
return groupName.match(new RegExp(utils.escapeRegexChars(query), 'i')); return groupName.match(new RegExp(utils.escapeRegexChars(query), 'i'));
}); });
@ -153,9 +159,6 @@ var async = require('async'),
callback(err, internals.filterGroups(groups, options)); callback(err, internals.filterGroups(groups, options));
}); });
}); });
} else {
callback(null, []);
}
}; };
Groups.isMember = function(uid, groupName, callback) { Groups.isMember = function(uid, groupName, callback) {

Loading…
Cancel
Save