forked from mirror/azerothcore-wotlk
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:
co-authored by
Roman BADANIN
Copilot
parent
a5b0cee779
commit
f554cde330
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user