improve error handling in FutureMoves::get_board_from_idx
This commit is contained in:
@@ -355,14 +355,14 @@ impl FutureMoves {
|
||||
}
|
||||
|
||||
fn get_board_from_idx(&self, idx: usize) -> Option<Board> {
|
||||
self.move_history(idx).map(|hist| {
|
||||
self.move_history(idx).and_then(|hist| {
|
||||
let mut board = self.board;
|
||||
for (m, c) in hist {
|
||||
if let Some(m) = m {
|
||||
board.place(m, c).expect("move would not propegate");
|
||||
board.place(m, c).ok()?;
|
||||
}
|
||||
}
|
||||
board
|
||||
Some(board)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user