fix(Core/Map): Ensure grid is valid before unloading to prevent potential … (#24621)

Co-authored-by: Roman BADANIN <[email protected]>
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Localhost
2026-03-22 11:54:14 -03:00
committed by GitHub
co-authored by Roman BADANIN Copilot
parent a5b0cee779
commit f554cde330
+3 -2
View File
@@ -1037,9 +1037,10 @@ void Map::UnloadAll()
for (GridRefMgr<MapGridType>::iterator i = GridRefMgr<MapGridType>::begin(); i != GridRefMgr<MapGridType>::end();)
{
MapGridType& grid(*i->GetSource());
MapGridType* grid = i->GetSource();
++i;
UnloadGrid(grid); // deletes the grid and removes it from the GridRefMgr
if (grid)
UnloadGrid(*grid);
}
// pussywizard: crashfix, some npc can be left on transport (not a default passenger)