From caefd2184a2b750415944b5c3508a11198319391 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 7 Nov 2021 01:30:39 -0400 Subject: [PATCH] PadMessageHandler: Don't fire `userLeave` if user hasn't joined yet --- src/node/handler/PadMessageHandler.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index fa8e45124..c9f8856b4 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -131,7 +131,8 @@ exports.handleDisconnect = async (socket) => { stats.meter('disconnects').mark(); const session = sessioninfos[socket.id]; delete sessioninfos[socket.id]; - if (!session || !session.author) return; + // session.padId can be nullish if the user disconnects before sending CLIENT_READY. + if (!session || !session.author || !session.padId) return; const {session: {user} = {}} = socket.client.request; /* eslint-disable prefer-template -- it doesn't support breaking across multiple lines */ accessLogger.info('[LEAVE]' +