summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/zlib.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/zlib.js b/lib/zlib.js
index 4a7c1ef153..3915e5ddab 100644
--- a/lib/zlib.js
+++ b/lib/zlib.js
@@ -474,7 +474,10 @@ function _close(engine, callback) {
engine._closed = true;
- engine._handle.close();
+ // Caller may invoke .close after a zlib error (which will null _handle).
+ if (engine._handle) {
+ engine._handle.close();
+ }
}
function emitCloseNT(self) {