Extra safety checks.

This commit is contained in:
Major Cooke 2024-02-22 18:20:40 -06:00 committed by Rachael Alexanderson
parent 5abd7e1ebf
commit 257ddb520a
2 changed files with 3 additions and 2 deletions

View file

@ -2589,7 +2589,7 @@ static bool FindPathAStar(AActor *chaser, AActor* startnode, AActor* goalnode, T
bool FLevelLocals::FindPath(AActor* chaser, AActor* target, AActor* startNode, AActor* goalNode) bool FLevelLocals::FindPath(AActor* chaser, AActor* target, AActor* startNode, AActor* goalNode)
{ {
if (!chaser || !target) if (!chaser || !target || PathNodes.Size() < 1)
{ {
return false; return false;
} }

View file

@ -2232,7 +2232,8 @@ DEFINE_ACTION_FUNCTION(AActor, ClearPath)
bool AActor::CanPathfind() bool AActor::CanPathfind()
{ {
if ((!(flags9 & MF9_NOPATHING) && !(Sector->MoreFlags & SECMF_NOPATHING)) && if (Level->PathNodes.Size() > 0 &&
(!(flags9 & MF9_NOPATHING) && !(Sector->MoreFlags & SECMF_NOPATHING)) &&
(flags9 & MF9_PATHING || Level->flags3 & LEVEL3_PATHING)) (flags9 & MF9_PATHING || Level->flags3 & LEVEL3_PATHING))
{ {
if ((flags6 & MF6_NOFEAR)) if ((flags6 & MF6_NOFEAR))