diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-04-19 11:58:35 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-04-28 23:35:58 +0200 |
commit | b145880739e1770ebeac914b769624d86c39645c (patch) | |
tree | a50f9ee7740f88958f4ef64394c4541e219b9524 | |
parent | c838861823a5a040a8e8cabb9b68500697028569 (diff) | |
download | server-b145880739e1770ebeac914b769624d86c39645c.tar.gz |
Don't crash if event streams are still listening when deleting a game.
-rw-r--r-- | server.js | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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") |