From 8eb4e03e9863f503df4a4a24b33b103fa61d4a78 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 5 Jan 2017 21:18:57 +0000 Subject: [PATCH] Fix crash on settings apply with no game detected --- src/backend/app/loot_state.cpp | 10 ++++++---- src/gui/html/js/events.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/backend/app/loot_state.cpp b/src/backend/app/loot_state.cpp index 2b11d47c..9537d283 100644 --- a/src/backend/app/loot_state.cpp +++ b/src/backend/app/loot_state.cpp @@ -102,10 +102,12 @@ void LootState::load(YAML::Node& settings) { selectGame(""); } - // Re-initialise the current game in case the game path setting was changed. - currentGame_->Init(true); - // Update game path in settings object. - storeGameSettings(toGameSettings(games_)); + if (currentGame_ != end(games_)) { + // Re-initialise the current game in case the game path setting was changed. + currentGame_->Init(true); + // Update game path in settings object. + storeGameSettings(toGameSettings(games_)); + } } void LootState::init(const std::string& cmdLineGame) { diff --git a/src/gui/html/js/events.js b/src/gui/html/js/events.js index 903d38a6..06bb3942 100644 --- a/src/gui/html/js/events.js +++ b/src/gui/html/js/events.js @@ -327,7 +327,7 @@ function onCloseSettingsDialog(evt) { loot.DOM.updateSelectedGame(loot.game.folder); }) .then(() => { - if (loot.game.folder.length === 0) { + if (loot.installedGames.length > 0 && loot.game.folder.length === 0) { /* Initialisation failed and game was configured in settings. */ onContentRefresh(); }