diff --git a/libs/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp b/libs/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp index 839ee1e81..49b741446 100644 --- a/libs/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp +++ b/libs/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp @@ -1032,7 +1032,9 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef, // The API input has been cheked already, skip checking internal data. const dtMeshTile* neighbourTile = 0; const dtPoly* neighbourPoly = 0; - m_nav->getTileAndPolyByRefUnsafe(neighbourRef, &neighbourTile, &neighbourPoly); + if (dtStatusFailed(m_nav->getTileAndPolyByRef(neighbourRef, &neighbourTile, &neighbourPoly))) { + continue; + } if (!filter->passFilter(neighbourRef, neighbourTile, neighbourPoly)) continue; @@ -1345,7 +1347,9 @@ dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters) // The API input has been cheked already, skip checking internal data. const dtMeshTile* neighbourTile = 0; const dtPoly* neighbourPoly = 0; - m_nav->getTileAndPolyByRefUnsafe(neighbourRef, &neighbourTile, &neighbourPoly); + if (dtStatusFailed(m_nav->getTileAndPolyByRef(neighbourRef, &neighbourTile, &neighbourPoly))) { + continue; + } if (!m_query.filter->passFilter(neighbourRef, neighbourTile, neighbourPoly)) continue;