Fixed bot navigation route when connected area somehow is null

This commit is contained in:
s1lentq 2023-12-31 07:56:45 +07:00
parent 6c9019bcc8
commit 991573f165
2 changed files with 8 additions and 1 deletions

View File

@ -294,6 +294,8 @@ void CNavArea::OnDestroyNotify(CNavArea *dead)
// Connect this area to given area in given direction
void CNavArea::ConnectTo(CNavArea *area, NavDirType dir)
{
DbgAssert(area);
// check if already connected
for (NavConnectList::iterator iter = m_connect[dir].begin(); iter != m_connect[dir].end(); iter++)
{

View File

@ -683,7 +683,7 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa
int ladderTopDir;
while (true)
{
CNavArea *newArea;
CNavArea *newArea = nullptr;
NavTraverseType how;
const CNavLadder *ladder = nullptr;
@ -716,6 +716,11 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa
newArea = (*floorIter).area;
how = (NavTraverseType)dir;
floorIter++;
DbgAssert(newArea);
if (!newArea)
continue;
}
// search ladders
else