bugfix - nullable straightPath

This commit is contained in:
ikpil 2023-06-20 21:13:25 +09:00
parent 58890825b3
commit 4112168f4a
1 changed files with 7 additions and 8 deletions

View File

@ -1532,14 +1532,14 @@ namespace DotRecast.Detour
ref List<StraightPathItem> straightPath, ref List<StraightPathItem> straightPath,
int maxStraightPath, int options) int maxStraightPath, int options)
{ {
straightPath.Clear(); if (!RcVec3f.IsFinite(startPos) || !RcVec3f.IsFinite(endPos) || null == straightPath
if (!RcVec3f.IsFinite(startPos) || !RcVec3f.IsFinite(endPos)
|| null == path || 0 == path.Count || path[0] == 0 || maxStraightPath <= 0) || null == path || 0 == path.Count || path[0] == 0 || maxStraightPath <= 0)
{ {
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM; return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
} }
straightPath.Clear();
// TODO: Should this be callers responsibility? // TODO: Should this be callers responsibility?
var closestStartPosRes = ClosestPointOnPolyBoundary(path[0], startPos, out var closestStartPos); var closestStartPosRes = ClosestPointOnPolyBoundary(path[0], startPos, out var closestStartPos);
if (closestStartPosRes.Failed()) if (closestStartPosRes.Failed())
@ -2794,7 +2794,6 @@ namespace DotRecast.Detour
IDtQueryFilter filter, IDtQueryFilter filter,
ref List<long> resultRef, ref List<long> resultParent) ref List<long> resultRef, ref List<long> resultParent)
{ {
// 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)