From cbf3da312fe71103feddd00e082145ee8ebef800 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 21 Dec 2020 16:40:46 -0800 Subject: [PATCH] Fix segfault when settings.vvv or unlock.vvv is missing To fix this bug, all we have to do is just pass the existing ScreenSettings* that we have in loadstats() to savestats(), and in loadsettings() to savesettings(). Fixes #556. Depends on #558. --- desktop_version/src/Game.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 21640aef..d8f3225c 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -4474,7 +4474,7 @@ void Game::loadstats(ScreenSettings* screen_settings) { // Save unlock.vvv only. Maybe we have a settings.vvv laying around too, // and we don't want to overwrite that! - savestats(); + savestats(screen_settings); printf("No Stats found. Assuming a new player\n"); } @@ -4953,7 +4953,7 @@ void Game::loadsettings(ScreenSettings* screen_settings) tinyxml2::XMLDocument doc; if (!FILESYSTEM_loadTiXml2Document("saves/settings.vvv", doc)) { - savesettings(); + savesettings(screen_settings); puts("No settings.vvv found"); }