Fix lobby deletion logic in gambling.js

This commit is contained in:
IM23a-spirgif
2025-05-08 11:13:49 +02:00
parent baea3d8513
commit 04c385fd92
+2 -2
View File
@@ -188,7 +188,7 @@ async function leaveLobby(id, username) {
async function deleteLobby(id) { async function deleteLobby(id) {
if (id && playerMap[id]) { if (id && playerMap[id]) {
if (playerMap[id].length === 0) { 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, () => { app.listen(port, () => {
console.log("Server is running on port " + port); console.log("Server is running on port " + port);
}); });