Fix crash on settings apply with no game detected

This commit is contained in:
Oliver Hamlet
2017-01-05 21:18:57 +00:00
parent be9f871443
commit 8eb4e03e98
2 changed files with 7 additions and 5 deletions
+6 -4
View File
@@ -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) {
+1 -1
View File
@@ -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();
}