fix crash

This commit is contained in:
Adam 2024-08-28 23:29:56 -04:00
parent d30d06bfdb
commit 791651a9da

View file

@ -172,23 +172,21 @@ impl Game {
// Move card from player's hand to judge pile // Move card from player's hand to judge pile
for id in &trimmed { for id in &trimmed {
let index = self if let Some(player) = self.players.get_mut(&player_user_id) {
.players if let Some(index) = player
.get(&player_user_id) .white
.unwrap() .iter()
.white .position(|card| card.uuid.to_string() == *id)
.iter() {
.position(|card| card.uuid.to_string() == *id) let card = player.white.remove(index);
.unwrap(); // TODO: Fix unknown explosion here
let card = self self.judge_pile.insert(card.uuid.to_string(), card);
.players } else {
.get_mut(&player_user_id) tracing::error!("Judging: Can't get index");
.unwrap() // TODO: Fix explosion here when user reconnects }
.white } else {
.remove(index); tracing::error!("Judging: Can't find player");
}
self.judge_pile.insert(card.uuid.to_string(), card);
} }
// Meta for convenience // Meta for convenience