Преглед изворни кода

check if socket exists before attempting to close in disconnect

ericz пре 12 година
родитељ
комит
a4a3f2d969
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      lib/peer.js

+ 3 - 1
lib/peer.js

@@ -299,7 +299,9 @@ Peer.prototype.destroy = function() {
  */
 Peer.prototype.disconnect = function() {
   if (!this.disconnected) {
-    this._socket.close();
+    if (!!this._socket) {
+      this._socket.close();
+    }
     this.id = null;
     this.disconnected = true;
   }