From b3ea1d54171abfe322a86a025fd8b1b0f19a7f0d Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Mon, 21 Nov 2016 00:47:18 +0100 Subject: [PATCH] Only add defined callbacks to the stack Before that commit, undefined callbacks were also added to the array, which could lead to 'Maximum call stack size exceeded' error when flush() method was called. Fixes #399 --- lib/socket.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/socket.js b/lib/socket.js index be97d3d35..4623268fc 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -393,8 +393,8 @@ Socket.prototype.sendPacket = function (type, data, options, callback) { this.writeBuffer.push(packet); - // add send callback to object - this.packetsFn.push(callback); + // add send callback to object, if defined + if (callback) this.packetsFn.push(callback); this.flush(); }