fix another crash

This commit is contained in:
Adam 2024-09-02 15:45:23 -04:00
parent 98fa49046a
commit c810524b0d

View file

@ -195,6 +195,14 @@ impl Game {
// Start judging if this is last player to submit // Start judging if this is last player to submit
if self.judge_pile_meta.len() == self.players.len() - 1 { 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(( Ok(Some((
JudgeRound { JudgeRound {
cards_to_judge: self cards_to_judge: self
@ -206,6 +214,7 @@ impl Game {
.iter() .iter()
.map(|id| { .map(|id| {
let card = self.judge_pile.get(id).unwrap().clone(); let card = self.judge_pile.get(id).unwrap().clone();
// TODO: Make sure card exists
WhiteCardMeta { WhiteCardMeta {
uuid: card.uuid.to_string(), uuid: card.uuid.to_string(),
text: card.text.clone(), text: card.text.clone(),