From 04c385fd92df00ba66f5533012afc4bd582e85d5 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 8 May 2025 11:13:49 +0200 Subject: [PATCH] Fix lobby deletion logic in gambling.js --- gambling.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gambling.js b/gambling.js index 01f131b..6d592b6 100644 --- a/gambling.js +++ b/gambling.js @@ -188,7 +188,7 @@ async function leaveLobby(id, username) { async function deleteLobby(id) { if (id && playerMap[id]) { if (playerMap[id].length === 0) { - playerMap[id].splice(playerMap.indexOf(id), 1); + delete playerMap[id]; } } } @@ -274,4 +274,4 @@ app.get("/lobby/players", authenticateToken, async (req, res) => { app.listen(port, () => { console.log("Server is running on port " + port); -}); +}); \ No newline at end of file