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:
committed by
Erik Michelson
parent
edf1f62b2e
commit
7e2a783161
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user