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:
Localhost 2026-03-22 15:54:14 +01:00 committed by GitHub
parent a5b0cee779
commit f554cde330
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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)