Skip to content

Commit

Permalink
zlib: prevent uncaught exception in zlibBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed May 27, 2015
1 parent 98649fd commit 4692e75
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,16 @@ function zlibBuffer(engine, buffer, callback) {
}

function onEnd() {
var buf = Buffer.concat(buffers, nread);
var buf;
var err = null;
try {
buf = Buffer.concat(buffers, nread);
} catch (e) {
err = e;
}
buffers = [];
callback(null, buf);
engine.close();
callback(err, buf);
}
}

Expand Down

0 comments on commit 4692e75

Please sign in to comment.