]> git.sesse.net Git - stockfish/blobdiff - src/main.cpp
Fix a crash issue when traversing PVs.
[stockfish] / 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());