summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/_stream_readable.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index 368c923b6..fd6396948 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);