Patch detour to avoid a crash if an invalid ref is returned

This commit is contained in:
KimLS 2018-05-31 19:24:26 -07:00
parent b475f66014
commit c985307057

View File

@ -1096,7 +1096,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 (m_nav->getTileAndPolyByRef(neighbourRef, &neighbourTile, &neighbourPoly) == DT_FAILURE) {
continue;
}
if (!filter->passFilter(neighbourRef, neighbourTile, neighbourPoly))
continue;