Fix lobby deletion logic in gambling.js
This commit is contained in:
+2
-2
@@ -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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user