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
|
// 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)
|
|
||||||
.unwrap()
|
|
||||||
.white
|
.white
|
||||||
.iter()
|
.iter()
|
||||||
.position(|card| card.uuid.to_string() == *id)
|
.position(|card| card.uuid.to_string() == *id)
|
||||||
.unwrap(); // TODO: Fix unknown explosion here
|
{
|
||||||
|
let card = player.white.remove(index);
|
||||||
let card = self
|
|
||||||
.players
|
|
||||||
.get_mut(&player_user_id)
|
|
||||||
.unwrap() // TODO: Fix explosion here when user reconnects
|
|
||||||
.white
|
|
||||||
.remove(index);
|
|
||||||
|
|
||||||
self.judge_pile.insert(card.uuid.to_string(), card);
|
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
|
// Meta for convenience
|
||||||
|
|
Loading…
Add table
Reference in a new issue