Browse Source

stream: check _events before _events.error

This fixes the regression introduced by 5458079, which breaks the
net/net-pipe benchmark script.

Closes #6145
v0.10.18-release
isaacs 11 years ago
parent
commit
fbb963b5d5
  1. 2
      lib/_stream_readable.js

2
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);

Loading…
Cancel
Save