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)
{
if (!chaser || !target)
if (!chaser || !target || PathNodes.Size() < 1)
{
return false;
}

View File

@ -2232,7 +2232,8 @@ DEFINE_ACTION_FUNCTION(AActor, ClearPath)
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))
{
if ((flags6 & MF6_NOFEAR))