bugfix crash

This commit is contained in:
ikpil 2023-07-16 16:14:44 +09:00
parent e22c31052c
commit 5588f6f17b
2 changed files with 10 additions and 2 deletions

View File

@ -2808,7 +2808,8 @@ namespace DotRecast.Detour
{
// Validate input
if (!m_nav.IsValidPolyRef(startRef) || !RcVec3f.IsFinite(centerPos) || radius < 0
|| !float.IsFinite(radius) || null == filter)
|| !float.IsFinite(radius) || null == filter
|| null == resultRef || null == resultParent)
{
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
}

View File

@ -335,7 +335,14 @@ public class TestNavmeshTool : IRcTool
if (m_sposSet && m_startRef != 0)
{
m_neighbourhoodRadius = _impl.GetSample().GetSettings().agentRadius * 20.0f;
m_navQuery.FindLocalNeighbourhood(m_startRef, m_spos, m_neighbourhoodRadius, m_filter, ref m_polys, ref m_parent);
List<long> resultRef = new();
List<long> resultParent = new();
var status = m_navQuery.FindLocalNeighbourhood(m_startRef, m_spos, m_neighbourhoodRadius, m_filter, ref resultRef, ref resultParent);
if (status.Succeeded())
{
m_polys = resultRef;
m_parent = resultParent;
}
}
}
else if (option.mode == TestNavmeshToolMode.RANDOM_POINTS_IN_CIRCLE)