From 692f3582ac8a33fed68811bdce679d0a7a717bc9 Mon Sep 17 00:00:00 2001 From: Marcel Schramm Date: Sat, 19 Oct 2024 23:15:58 +0200 Subject: [PATCH] Fixes #344 --- internal/game/lobby.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/game/lobby.go b/internal/game/lobby.go index 683180e1..a97feb61 100644 --- a/internal/game/lobby.go +++ b/internal/game/lobby.go @@ -241,6 +241,12 @@ func (lobby *Lobby) handleToggleReadinessEvent(player *Player) { } func (lobby *Lobby) readyToStart() bool { + // Otherwise the game will start and gameover instantly. This can happen + // if a lobby is created and the owner refreshes. + if !lobby.HasConnectedPlayers() { + return false + } + for _, otherPlayer := range lobby.players { if otherPlayer.Connected && otherPlayer.State != Ready { return false