Fix crash when passing a mate/stalemate position

Both Tablebases::filter_root_moves() and
extract_ponder_from_tt(9 were unable to handle
a mate/stalemate position.

Spotted and reported by Dann Corbit.

Added some mate/stalemate positions to bench so
to early catch this regression in the future.

No functional change.
This commit is contained in:
Marco Costalba
2016-09-24 07:30:37 +02:00
parent 28240d375c
commit 8662bdfa12
3 changed files with 13 additions and 2 deletions

View File

@@ -184,7 +184,8 @@ void ThreadPool::start_thinking(Position& pos, StateListPtr& states,
|| std::count(limits.searchmoves.begin(), limits.searchmoves.end(), m))
rootMoves.push_back(Search::RootMove(m));
Tablebases::filter_root_moves(pos, rootMoves);
if (!rootMoves.empty())
Tablebases::filter_root_moves(pos, rootMoves);
// After ownership transfer 'states' becomes empty, so if we stop the search
// and call 'go' again without setting a new position states.get() == NULL.