Skip to content

Commit

Permalink
Fix negative time command handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bdmendes committed May 1, 2024
1 parent 3b55858 commit f2b643d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/engine/commands/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,11 @@ pub fn parse_go(words: &mut VecDeque<&str>) -> Result<Command, String> {
}
"wtime" => {
let value = words.pop_front().ok_or("No value found")?;
white_time = Some(Duration::from_millis(
value.parse::<u64>().map_err(|_| "Invalid wtime value")?,
));
white_time = Some(Duration::from_millis(value.parse::<u64>().unwrap_or(0)));
}
"btime" => {
let value = words.pop_front().ok_or("No value found")?;
black_time = Some(Duration::from_millis(
value.parse::<u64>().map_err(|_| "Invalid btime value")?,
));
black_time = Some(Duration::from_millis(value.parse::<u64>().unwrap_or(0)));
}
"winc" => {
let value = words.pop_front().ok_or("No value found")?;
Expand Down

0 comments on commit f2b643d

Please sign in to comment.