From d99ab32cc5abb5bd8d715df8c1bd3c603f8f5728 Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 13 Apr 2011 18:49:38 -0400 Subject: [PATCH] [fix] Dont allow `async.forEach` to be called on undefined or null arrays --- lib/nconf/stores/redis.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/nconf/stores/redis.js b/lib/nconf/stores/redis.js index cace4b0..1b7a8ee 100644 --- a/lib/nconf/stores/redis.js +++ b/lib/nconf/stores/redis.js @@ -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);