Skip to content

Commit

Permalink
Fixed bot navigation route when connected area somehow is null
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Dec 31, 2023
1 parent 6c9019b commit 991573f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions regamedll/game_shared/bot/nav_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down
7 changes: 6 additions & 1 deletion regamedll/game_shared/bot/nav_area.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 991573f

Please sign in to comment.