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