Skip to content

Node.js based forum software built for the modern web

fix crash if socket.handshake is null

psychobunny25c7dfbc12fe
diff --git a/src/socket.io/index.js b/src/socket.io/index.js
index 84d52fdb5b..c58ce1dc95 100644
--- a/src/socket.io/index.js
+++ b/src/socket.io/index.js
@@ -115,10 +115,14 @@ Sockets.init = function(server) {
var hs = socket.handshake,
sessionID, uid;
+ if (!hs) {
+ return;
+ }
+
// Validate the session, if present
socketCookieParser(hs, {}, function(err) {
if(err) {
- winston.error(err.message);
+ return winston.error(err.message);
}
sessionID = socket.handshake.signedCookies['express.sid'];