@@ -1297,6 +1297,14 @@ Bool PathfindCell::allocateInfo( const ICoord2D &pos )
1297
1297
*/
1298
1298
void PathfindCell::releaseInfo ( void )
1299
1299
{
1300
+ @TheSuperHackers @info 04 /06 /2025 Skyaero/Mauller
1301
+ // Parent cells don't always gets cleared if one of the conditions below is true.
1302
+ // But they should be cleared anyway, otherwise future path
1303
+ // generation could yield an invalid path, causing a application crash.
1304
+ if (m_info && m_info->m_pathParent ) {
1305
+ m_info->m_pathParent = NULL ;
1306
+ }
1307
+
1300
1308
if (m_type==PathfindCell::CELL_OBSTACLE) {
1301
1309
return ;
1302
1310
}
@@ -7525,6 +7533,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7525
7533
PathfindLayerEnum layer = TheTerrainLogic->getLayerForDestination (from);
7526
7534
PathfindCell *parentCell = getClippedCell ( layer,&clipFrom );
7527
7535
if (parentCell == NULL ) {
7536
+ goalCell->releaseInfo ();
7528
7537
return NULL ;
7529
7538
}
7530
7539
if (parentCell!=goalCell) {
@@ -8812,6 +8821,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
8812
8821
if (parentCell!=goalCell) {
8813
8822
worldToCell (&clipFrom, &pos2d);
8814
8823
if (!parentCell->allocateInfo (pos2d)) {
8824
+ goalCell->releaseInfo ();
8815
8825
return NULL ;
8816
8826
}
8817
8827
}
0 commit comments