1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

[editor] fix crash on quit with an opened map

This commit is contained in:
Andrey Filipenkov 2024-06-13 06:46:41 +03:00
parent 9438c5f9f7
commit b5cc3e8dc6

View File

@ -58,6 +58,7 @@ void MapController::connectScenes()
MapController::~MapController() MapController::~MapController()
{ {
main = nullptr;
} }
const std::unique_ptr<CMap> & MapController::getMapUniquePtr() const const std::unique_ptr<CMap> & MapController::getMapUniquePtr() const
@ -229,6 +230,8 @@ void MapController::setMap(std::unique_ptr<CMap> cmap)
_map->getEditManager()->getUndoManager().setUndoCallback([this](bool allowUndo, bool allowRedo) _map->getEditManager()->getUndoManager().setUndoCallback([this](bool allowUndo, bool allowRedo)
{ {
if(!main)
return;
main->enableUndo(allowUndo); main->enableUndo(allowUndo);
main->enableRedo(allowRedo); main->enableRedo(allowRedo);
} }