forked from mirror/DotRecast
bugfix crash
This commit is contained in:
parent
e22c31052c
commit
5588f6f17b
|
@ -2808,7 +2808,8 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
// Validate input
|
// Validate input
|
||||||
if (!m_nav.IsValidPolyRef(startRef) || !RcVec3f.IsFinite(centerPos) || radius < 0
|
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;
|
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,7 +335,14 @@ public class TestNavmeshTool : IRcTool
|
||||||
if (m_sposSet && m_startRef != 0)
|
if (m_sposSet && m_startRef != 0)
|
||||||
{
|
{
|
||||||
m_neighbourhoodRadius = _impl.GetSample().GetSettings().agentRadius * 20.0f;
|
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)
|
else if (option.mode == TestNavmeshToolMode.RANDOM_POINTS_IN_CIRCLE)
|
||||||
|
|
Loading…
Reference in New Issue