mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
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:
@@ -1037,9 +1037,10 @@ void Map::UnloadAll()
|
|||||||
|
|
||||||
for (GridRefMgr<MapGridType>::iterator i = GridRefMgr<MapGridType>::begin(); i != GridRefMgr<MapGridType>::end();)
|
for (GridRefMgr<MapGridType>::iterator i = GridRefMgr<MapGridType>::begin(); i != GridRefMgr<MapGridType>::end();)
|
||||||
{
|
{
|
||||||
MapGridType& grid(*i->GetSource());
|
MapGridType* grid = i->GetSource();
|
||||||
++i;
|
++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)
|
// pussywizard: crashfix, some npc can be left on transport (not a default passenger)
|
||||||
|
|||||||
Reference in New Issue
Block a user