diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 6aad552e7a5279..c9b0a87b3dbd0c 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -571,7 +571,9 @@ OutgoingMessage.prototype.end = function(data, encoding, callback) { // There is the first message on the outgoing queue, and we've sent // everything to the socket. debug('outgoing message end.'); - if (this.output.length === 0 && this.connection._httpMessage === this) { + if (this.output.length === 0 && + this.connection && + this.connection._httpMessage === this) { this._finish(); }