diff --git a/src/neural/memcache.cc b/src/neural/memcache.cc index c2407bee55..b176c94cf7 100644 --- a/src/neural/memcache.cc +++ b/src/neural/memcache.cc @@ -141,8 +141,11 @@ std::optional MemCache::GetCachedEvaluation( result.d = lock->d; result.q = lock->q; result.m = lock->m; - std::copy(lock->p.get(), lock->p.get() + pos.legal_moves.size(), - result.p.begin()); + if (lock->p) { + result.p.reserve(pos.legal_moves.size()); + std::copy(lock->p.get(), lock->p.get() + pos.legal_moves.size(), + std::back_inserter(result.p)); + } return result; }