From c0ce3b7bff28dc4981d4b55ba0b4327d3f610f96 Mon Sep 17 00:00:00 2001 From: Baptiste Fouques Date: Tue, 24 Jan 2023 10:57:33 +0100 Subject: [PATCH] prevent loop when none input --- chess_uci/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chess_uci/src/lib.rs b/chess_uci/src/lib.rs index 26a4ce7..22798fc 100644 --- a/chess_uci/src/lib.rs +++ b/chess_uci/src/lib.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] /// Manage UCI messages and link into chess component -mod uci_command; +pub mod uci_command; use log::{info, warn}; use std::io::*; @@ -63,8 +63,10 @@ impl UciEngine { self.push(GuiCommand::Uci); // Consume commands until uciok messages - while !self.uciok { - self.pull(); + if self.source.is_some() { + while !self.uciok { + self.pull(); + } } }