Merge pull request #136 from Janiels/null-check
findNearestPoly now fails when nearestRef is null, and only assigns it when the function succeeds
This commit is contained in:
commit
68ec46a685
@ -712,7 +712,8 @@ dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* exten
|
||||
{
|
||||
dtAssert(m_nav);
|
||||
|
||||
*nearestRef = 0;
|
||||
if (!nearestRef)
|
||||
return DT_FAILURE | DT_INVALID_PARAM;
|
||||
|
||||
// Get nearby polygons from proximity grid.
|
||||
const int MAX_SEARCH = 128;
|
||||
@ -721,6 +722,8 @@ dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* exten
|
||||
if (dtStatusFailed(queryPolygons(center, extents, filter, polys, &polyCount, MAX_SEARCH)))
|
||||
return DT_FAILURE | DT_INVALID_PARAM;
|
||||
|
||||
*nearestRef = 0;
|
||||
|
||||
if (polyCount == 0)
|
||||
return DT_SUCCESS;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user