From 97d8bd5bd406e3171f502abe8a60701f778270e1 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 14 Aug 2020 15:42:30 -0700 Subject: [PATCH] only replace handle error handler if it didn't have an error --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 196bf09..fbaf69e 100644 --- a/index.js +++ b/index.js @@ -164,10 +164,12 @@ class ZlibBase extends Minipass { // after each call, these handlers start piling up. this[_handle].removeAllListeners('error') // make sure OUR error listener is still attached tho - this[_handle].on('error', er => this[_onError](new ZlibError(er))) } } + if (this[_handle]) + this[_handle].on('error', er => this[_onError](new ZlibError(er))) + let writeReturn if (result) { if (Array.isArray(result) && result.length > 0) {