group null and err check

v1.18.x
barisusakli 11 years ago
parent dc68dce27f
commit d9a0af712d

@ -16,6 +16,9 @@
// Remove system, hidden, or deleted groups from this list // Remove system, hidden, or deleted groups from this list
if (groups && !options.showAllGroups) { if (groups && !options.showAllGroups) {
return groups.filter(function (group) { return groups.filter(function (group) {
if (!group) {
return false;
}
if (group.deleted || (group.hidden && !group.system) || (!options.showSystemGroups && group.system)) { if (group.deleted || (group.hidden && !group.system) || (!options.showSystemGroups && group.system)) {
return false; return false;
} else if (options.removeEphemeralGroups && ephemeralGroups.indexOf(group.name) !== -1) { } else if (options.removeEphemeralGroups && ephemeralGroups.indexOf(group.name) !== -1) {
@ -57,6 +60,9 @@
Groups.list = function(options, callback) { Groups.list = function(options, callback) {
db.getSetMembers('groups', function (err, groupNames) { db.getSetMembers('groups', function (err, groupNames) {
if (err) {
return callback(err);
}
groupNames = groupNames.concat(ephemeralGroups); groupNames = groupNames.concat(ephemeralGroups);
async.map(groupNames, function (groupName, next) { async.map(groupNames, function (groupName, next) {

Loading…
Cancel
Save