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 Oct 6, 2014
1 parent 51b4ea3 commit b806389
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/winston/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,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 b806389

Please sign in to comment.