]> git.sesse.net Git - stockfish/commitdiff
Fix a crash issue when traversing PVs.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 15 Nov 2016 21:03:15 +0000 (22:03 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 24 Nov 2018 10:17:41 +0000 (11:17 +0100)
src/main.cpp

index de220eec97a8ae16bf98a85c0c59df3f0b400865..76aca51d2e8f5f13d8178029ab1f4427bbdab0d3 100644 (file)
@@ -119,7 +119,9 @@ void HashProbeImpl::ProbeMove(Position* pos, std::deque<StateInfo>* setup_states
                // Follow the PV until we hit an illegal move.
                std::stack<Move> pv;
                std::set<Key> seen;
-               while (found && is_ok(entry->move())) {
+               while (found && is_ok(entry->move()) &&
+                      pos->pseudo_legal(entry->move()) &&
+                      pos->legal(entry->move())) {
                        FillMove(entry->move(), response->add_pv());
                        if (seen.count(pos->key())) break;
                        pv.push(entry->move());