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 <philip.molares@udo.edu>
This commit is contained in:
Philip Molares
2026-02-21 20:40:33 +01:00
committed by Erik Michelson
parent edf1f62b2e
commit 7e2a783161

View File

@@ -384,6 +384,9 @@ function finishConnection (socket, noteId, socketId) {
} }
const note = notes[noteId] const note = notes[noteId]
const user = users[socketId] const user = users[socketId]
if (!user) {
return failConnection(500, 'user not found', socket)
}
// update user color to author color // update user color to author color
if (note.authors[user.userid]) { if (note.authors[user.userid]) {
user.color = users[socket.id].color = note.authors[user.userid].color user.color = users[socket.id].color = note.authors[user.userid].color