diff --git a/lib/realtime.js b/lib/realtime.js index ac727180..35b86266 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -384,6 +384,9 @@ function finishConnection (socket, noteId, socketId) { } const note = notes[noteId] const user = users[socketId] + if (!user) { + return failConnection(500, 'user not found', socket) + } // update user color to author color if (note.authors[user.userid]) { user.color = users[socket.id].color = note.authors[user.userid].color