diff --git a/rts/Sim/Path/QTPFS/PathManager.cpp b/rts/Sim/Path/QTPFS/PathManager.cpp index 1aa5e9a36c..247a277049 100644 --- a/rts/Sim/Path/QTPFS/PathManager.cpp +++ b/rts/Sim/Path/QTPFS/PathManager.cpp @@ -933,6 +933,15 @@ bool QTPFS::PathManager::InitializeSearch(QTPFS::entity searchEntity) { assert((registry.any_of(pathEntity))); IPath* path = GetPath(pathEntity); assert(path->GetPathType() == pathType); + + // Somehow units can get wiped without triggering a delete. This is a catch for that until the + // cause can be found and resolved. + const CSolidObject* owner = path->GetOwner(); + if (owner != nullptr) { + if (owner->objectUsable == false) + return false; + } + search->Initialize(&nodeLayer, path->GetSourcePoint(), path->GetGoalPosition(), path->GetOwner()); path->SetHash(search->GetHash()); path->SetVirtualHash(search->GetPartialSearchHash()); @@ -1122,20 +1131,13 @@ bool QTPFS::PathManager::ExecuteSearch( int currentThread = ThreadPool::GetThreadNum(); assert(search != nullptr); + assert(search->initialized); // temp-path might have been removed already via // DeletePath before we got a chance to process it if (path == nullptr) return false; - // Somehow units can get wiped without triggering a delete. This is a catch for that until the - // cause can be found and resolved. - const CSolidObject* owner = path->GetOwner(); - if (owner != nullptr) { - if (owner->objectUsable == false) - return false; - } - assert(path->GetID() == search->GetID()); bool forceFullPath = false;