From c810524b0d367548424b4e123b888e513a2b50e3 Mon Sep 17 00:00:00 2001 From: Adam <24621027+WhiteDopeOnPunk@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:45:23 -0400 Subject: [PATCH] fix another crash --- server/src/game.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/src/game.rs b/server/src/game.rs index dfc25d6..5914d3c 100644 --- a/server/src/game.rs +++ b/server/src/game.rs @@ -195,6 +195,14 @@ impl Game { // Start judging if this is last player to submit if self.judge_pile_meta.len() == self.players.len() - 1 { + for group in self.judge_pile_meta.keys() { + for card_id in group { + if !self.judge_pile.contains_key(card_id) { + tracing::error!("Trying to judge a card not in play"); + return Err("Trying to judge a card not in play".to_string()); + } + } + } Ok(Some(( JudgeRound { cards_to_judge: self @@ -206,6 +214,7 @@ impl Game { .iter() .map(|id| { let card = self.judge_pile.get(id).unwrap().clone(); + // TODO: Make sure card exists WhiteCardMeta { uuid: card.uuid.to_string(), text: card.text.clone(),