Skip to content

Commit

Permalink
Fix bug where callback might be called twice
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Mar 12, 2013
1 parent 421cc95 commit 40fa4d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Cache.js
Expand Up @@ -140,11 +140,11 @@ Cache.prototype.get = function (key, callback) {
if (typeof key === 'function') {
callback = key;
this.keys('*', true, function (err, keys) {
if (err) callback(err, null);
if (err) return callback(err, null);
multi_get(keys);
});
} else if (Array.isArray(key)) {
if (!key.length) callback(null, null);
if (!key.length) return callback(null, null);
for (var get = [], i = 0, l = key.length; i < l; i++) {
key[i] = this.getKey(key[i]);
}
Expand Down

0 comments on commit 40fa4d2

Please sign in to comment.