1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

Fixed crash on empty save game list after filtering

This commit is contained in:
Ivan Savenko 2023-04-19 23:12:30 +03:00
parent 3d30e04184
commit b517adfb25
3 changed files with 4 additions and 5 deletions

View File

@ -4,6 +4,7 @@
* Fixed movement cost penalty from terrain
* Fixed empty Black Market on game start
* Fixed centering of scenario information window
* Fixed crash on empty save game list after filtering
* Fixed blocked progress in Launcher on language detection failure
* Launcher will now correctly handle selection of Data directory in H3 install

View File

@ -31,8 +31,6 @@ CSavingScreen::CSavingScreen()
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
center(pos);
// TODO: we should really use std::shared_ptr for passing StartInfo around.
localSi = new StartInfo(*LOCPLINT->cb->getStartInfo());
localMi = std::make_shared<CMapInfo>();
localMi->mapHeader = std::unique_ptr<CMapHeader>(new CMapHeader(*LOCPLINT->cb->getMapHeader()));
@ -52,7 +50,9 @@ const CMapInfo * CSavingScreen::getMapInfo()
const StartInfo * CSavingScreen::getStartInfo()
{
return localSi;
if (localMi)
return localMi->scenarioOptionsOfSave;
return LOCPLINT->cb->getStartInfo();
}
void CSavingScreen::changeSelection(std::shared_ptr<CMapInfo> to)
@ -61,7 +61,6 @@ void CSavingScreen::changeSelection(std::shared_ptr<CMapInfo> to)
return;
localMi = to;
localSi = localMi->scenarioOptionsOfSave;
card->changeSelection();
}

View File

@ -23,7 +23,6 @@ class CSelectionBase;
class CSavingScreen : public CSelectionBase
{
public:
const StartInfo * localSi;
std::shared_ptr<CMapInfo> localMi;
CSavingScreen();