summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-09-15 18:58:06 +0200
committerTor Andersson <tor@ccxvii.net>2023-09-15 18:59:25 +0200
commitb451c726d5f144d9a42224c457cc175d4fc8c093 (patch)
treed0610d0d56b28ca603de8011919738117e01a708 /server.js
parente94ef87d23f1ea8ffe74390e95f6dedad1fc515d (diff)
downloadserver-b451c726d5f144d9a42224c457cc175d4fc8c093.tar.gz
Fix crash when updating unread chats if anonymous observers are present.
Diffstat (limited to 'server.js')
-rw-r--r--server.js2
1 files changed, 1 insertions, 1 deletions
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)