From ae0b96571134e640ccebcd4a79983340b9494a7a Mon Sep 17 00:00:00 2001 From: Joona Kiiski Date: Sat, 28 Nov 2009 20:49:36 +0200 Subject: [PATCH] Do not crash if we are asked to search mate or stalemate position. We might be asked to ponder mate or stalemate position. This being the case, simply wait for stop or ponderhit. Currently we crash. UCI specs aren't clear on the issue, but it cost nothing to add little check. Signed-off-by: Marco Costalba --- src/search.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/search.cpp b/src/search.cpp index b8669328..4b93a210 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -677,6 +677,14 @@ namespace { // searchMoves are verified, copied, scored and sorted RootMoveList rml(p, searchMoves); + if (rml.move_count() == 0) + { + if (PonderSearch) + wait_for_stop_or_ponderhit(); + + return pos.is_check()? -VALUE_MATE : VALUE_DRAW; + } + // Print RootMoveList c'tor startup scoring to the standard output, // so that we print information also for iteration 1. std::cout << "info depth " << 1 << "\ninfo depth " << 1 -- 2.39.2