Skip to content

Commit

Permalink
[fix] Dont allow async.forEach to be called on undefined or null ar…
Browse files Browse the repository at this point in the history
…rays
  • Loading branch information
indexzero committed Apr 13, 2011
1 parent 7484fdb commit d99ab32
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/nconf/stores/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -292,6 +292,7 @@ Redis.prototype.load = function (callback) {
});
}

keys = keys || [];
async.forEach(keys, addValue, function (err) {
return err ? callback(err) : callback(null, result);
});
Expand All @@ -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);
Expand Down

0 comments on commit d99ab32

Please sign in to comment.