fix crash
This commit is contained in:
parent
d30d06bfdb
commit
791651a9da
1 changed files with 14 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue