From 3207789c844dd48f4647e8fa7693d35d6559927e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 23 Mar 2025 00:12:56 +0100 Subject: Add paranoid safeguard against impossible case. --- rules.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 078024f..a93cde7 100644 --- a/rules.js +++ b/rules.js @@ -163,7 +163,11 @@ function setup_player_turn(faction_id) { next(); } else { - setup_player_turn(get_next_faction_in_player_order(next_faction)); + const next_next_faction = get_next_faction_in_player_order(next_faction); + if (game.selected_cards[next_next_faction].length > 0) + setup_player_turn(get_next_faction_in_player_order(next_next_faction)); + else + throw new Error("impossible situation"); } } function check_end_of_year_discard() { -- cgit v1.2.3