fix(Core/Map): Ensure grid is valid before unloading to prevent potential … (#24621)
Co-authored-by: Roman BADANIN <r.badanin@defi-informatique.fr> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
a5b0cee779
commit
f554cde330
1 changed files with 3 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue