From 5d4f99c4305e28edb9c35a4086027e992c19439b Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 23 Jul 2018 15:48:25 +1000 Subject: [PATCH] Server stability --- server.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server.js b/server.js index 577045d5..01d21bed 100644 --- a/server.js +++ b/server.js @@ -147,6 +147,11 @@ ptserver_io.on('connection', (socket) => { socket.emit('rejoin') return } + let room = ptserver_io.sockets.adapter.rooms[socket.selfUser.room] + if (!room) { + console.log('Got a poll update from a user in a room that was either destroyed or never existed', data) + return + } // Recieved an update from a user updateUserData(socket.selfUser.username, data, socket.selfUser.room)