From 7e2a78316158f3f484ba03f9bed2b2d4c6256113 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Sat, 21 Feb 2026 20:40:33 +0100 Subject: [PATCH] fix(realtime): aboard finishConnection if user is missing This can happen if the user disconnects during connection creation. See #6101 Signed-off-by: Philip Molares --- lib/realtime.js | 3 +++ 1 file changed, 3 insertions(+) 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