From bf175b44401cb9a0607c2867501625d57a7b7c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Mon, 18 Feb 2013 18:41:51 +0100 Subject: [PATCH] If the socket is destroyed, node.js from 0.8.20 version will raise an error here. --- lib/socket.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/socket.js b/lib/socket.js index d9807f6dd2..dcbd43811b 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -365,5 +365,9 @@ Socket.prototype.emit = function (ev) { packet.args = args; - return this.packet(packet); + try { + return this.packet(packet); + } catch(e) { + return null; + } };