Skip to content

Commit

Permalink
[fix] Be more defensive when working with query methods from Transp…
Browse files Browse the repository at this point in the history
…orts. Fixes #356.
  • Loading branch information
indexzero committed Sep 24, 2014
1 parent eaebaa9 commit cf27437
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/winston/logger.js
Expand Up @@ -252,11 +252,20 @@ Logger.prototype.query = function (options, callback) {
//
function addResults (transport, next) {
queryTransport(transport, function (err, result) {
result = err || result;
if (result) {
results[transport.name] = result;
//
// queryTransport could potentially invoke the callback
// multiple times since Transport code can be unpredictable.
//
if (next) {
result = err || result;
if (result) {
results[transport.name] = result;
}

next();
}
next();

next = null;
});
}

Expand Down

0 comments on commit cf27437

Please sign in to comment.