From b451c726d5f144d9a42224c457cc175d4fc8c093 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 15 Sep 2023 18:58:06 +0200 Subject: Fix crash when updating unread chats if anonymous observers are present. --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index c3487e1..c07b0d8 100644 --- a/server.js +++ b/server.js @@ -2369,7 +2369,7 @@ function on_chat(socket, message) { for (let user_id of users) { let found = false for (let other of game_clients[socket.game_id]) - if (other.user.user_id === user_id) + if (other.user && other.user.user_id === user_id && other.role !== "Observer") found = true if (!found) SQL_INSERT_UNREAD_CHAT.run(user_id, socket.game_id) -- cgit v1.2.3