From 1d05d6c76bdb4ac8be5d217a9875955d887c6046 Mon Sep 17 00:00:00 2001 From: wood1986 <5212215+wood1986@users.noreply.github.com> Date: Thu, 15 Aug 2019 22:02:41 -0700 Subject: [PATCH] fix: Cannot read property 'headers' of null at Server.socket.on --- lib/servers/SockJSServer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/servers/SockJSServer.js b/lib/servers/SockJSServer.js index 782b325a48..c12913a5a7 100644 --- a/lib/servers/SockJSServer.js +++ b/lib/servers/SockJSServer.js @@ -64,7 +64,7 @@ module.exports = class SockJSServer extends BaseServer { // f should be passed the resulting connection and the connection headers onConnection(f) { this.socket.on('connection', (connection) => { - f(connection, connection.headers); + f(connection, connection ? connection.headers : null); }); }