From fbb963b5d520a70d9c3f2f9ec116d79a0c676f80 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 28 Aug 2013 09:35:36 -0700 Subject: [PATCH] stream: check _events before _events.error This fixes the regression introduced by 5458079, which breaks the net/net-pipe benchmark script. Closes #6145 --- lib/_stream_readable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 368c923..fd63969 100755 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -519,7 +519,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { } // This is a brutally ugly hack to make sure that our error handler // is attached before any userland ones. NEVER DO THIS. - if (!dest._events.error) + if (!dest._events || !dest._events.error) dest.on('error', onerror); else if (Array.isArray(dest._events.error)) dest._events.error.unshift(onerror); -- 2.7.4