guard against crashes if set is null or not passed in

v1.18.x
Julian Lam 7 years ago
parent 6dbe0b68e1
commit 341a8d5046

@ -76,7 +76,7 @@ module.exports = function (User) {
property = 'uid';
}
if (!Array.isArray(set) || !set.length || !(set[0].hasOwnProperty(property) || typeof set[0] === 'number' || typeof set[0] === 'string')) {
if (!set || !Array.isArray(set) || !set.length || !(set[0].hasOwnProperty(property) || typeof set[0] === 'number' || typeof set[0] === 'string')) {
return callback(null, set);
}

Loading…
Cancel
Save