[fix] Dont allow async.forEach
to be called on undefined or null arrays
This commit is contained in:
parent
7484fdb7a0
commit
d99ab32cc5
1 changed files with 4 additions and 2 deletions
|
@ -280,7 +280,7 @@ Redis.prototype.load = function (callback) {
|
|||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
|
||||
function addValue (key, next) {
|
||||
self.get(key, function (err, value) {
|
||||
if (err) {
|
||||
|
@ -292,6 +292,7 @@ Redis.prototype.load = function (callback) {
|
|||
});
|
||||
}
|
||||
|
||||
keys = keys || [];
|
||||
async.forEach(keys, addValue, function (err) {
|
||||
return err ? callback(err) : callback(null, result);
|
||||
});
|
||||
|
@ -316,7 +317,8 @@ Redis.prototype.reset = function (callback) {
|
|||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
|
||||
existing = existing || [];
|
||||
async.forEach(existing, function (key, next) {
|
||||
self.clear(key, next);
|
||||
}, callback);
|
||||
|
|
Loading…
Reference in a new issue