summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-04-19 11:58:35 +0200
committerTor Andersson <tor@ccxvii.net>2023-04-28 23:35:58 +0200
commitb145880739e1770ebeac914b769624d86c39645c (patch)
treea50f9ee7740f88958f4ef64394c4541e219b9524 /server.js
parentc838861823a5a040a8e8cabb9b68500697028569 (diff)
downloadserver-b145880739e1770ebeac914b769624d86c39645c.tar.gz
Don't crash if event streams are still listening when deleting a game.
Diffstat (limited to 'server.js')
-rw-r--r--server.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/server.js b/server.js
index 604ff94..5b76883 100644
--- a/server.js
+++ b/server.js
@@ -1543,9 +1543,11 @@ app.get('/join-events/:game_id', must_be_logged_in, function (req, res) {
res.on('close', () => {
let list = join_clients[game_id]
- let i = list.findIndex(item => item.res === res)
- if (i >= 0)
- list.splice(i, 1)
+ if (list) {
+ let i = list.findIndex(item => item.res === res)
+ if (i >= 0)
+ list.splice(i, 1)
+ }
})
res.write("retry: 15000\n\n")