Skip to content

Commit b016746

Browse files
committed
[ZH] Catch dangling parent cell crash in PathfindCell::costSoFar()
1 parent 92eed40 commit b016746

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,16 @@ UnsignedInt PathfindCell::costSoFar( PathfindCell *parent )
18121812
Int numTurns = 0;
18131813
PathfindCell *prevCell = parent->getParentCell();
18141814
if (prevCell) {
1815+
1816+
#if RETAIL_COMPATIBLE_PATHFINDING
1817+
// TheSuperHackers @info this is a possible crash point in the retail pathfinding, we just prevent the crash at this point
1818+
// External code should catch the issue in another block and cleanup the pathfinding before switching to the fixed pathfinding.
1819+
if (!prevCell->hasInfo())
1820+
{
1821+
return cost;
1822+
}
1823+
#endif
1824+
18151825
ICoord2D dir;
18161826
dir.x = prevCell->getXIndex() - parent->getXIndex();
18171827
dir.y = prevCell->getYIndex() - parent->getYIndex();

0 commit comments

Comments
 (0)