diff --git a/lib/events.js b/lib/events.js index 209700e65ad596..000fa98d5a88c5 100644 --- a/lib/events.js +++ b/lib/events.js @@ -148,7 +148,8 @@ EventEmitter.prototype.emit = function emit(type) { // If there is no 'error' event listener then throw. if (doError) { - er = arguments[1]; + if (arguments.length > 1) + er = arguments[1]; if (domain) { if (!er) er = new Error('Uncaught, unspecified "error" event');