diff --git a/src/peer.js b/src/peer.js index df8fcfd..1e16c61 100644 --- a/src/peer.js +++ b/src/peer.js @@ -158,7 +158,9 @@ class Peer { // no connection to close } // end the pushable pull-stream - this.stream.end() + if (this.stream) { + this.stream.end() + } setImmediate(() => { this.conn = null this.stream = null