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
for id in &trimmed {
let index = self
.players
.get(&player_user_id)
.unwrap()
if let Some(player) = self.players.get_mut(&player_user_id) {
if let Some(index) = player
.white
.iter()
.position(|card| card.uuid.to_string() == *id)
.unwrap(); // TODO: Fix unknown explosion here
let card = self
.players
.get_mut(&player_user_id)
.unwrap() // TODO: Fix explosion here when user reconnects
.white
.remove(index);
{
let card = player.white.remove(index);
self.judge_pile.insert(card.uuid.to_string(), card);
} else {
tracing::error!("Judging: Can't get index");
}
} else {
tracing::error!("Judging: Can't find player");
}
}
// Meta for convenience