From 77a0881b43a6cc371c04cd54f677ad87ab43cd35 Mon Sep 17 00:00:00 2001 From: AWildErin Date: Wed, 31 Dec 2025 01:08:41 +0000 Subject: [PATCH] fix: Check count for recent config settings Fix for a bug where if you clear the recent config, it would break all future launches --- src/Window.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Window.cpp b/src/Window.cpp index 022e785..4f8033b 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -171,7 +171,8 @@ Window::Window(QWidget* parent) new QVBoxLayout(this->main); - if (QSettings settings; !settings.contains(STR_RECENT_CONFIGS)) { + QSettings settings; + if (!settings.contains(STR_RECENT_CONFIGS) || settings.value(STR_RECENT_CONFIGS).value().empty()) { settings.setValue(STR_RECENT_CONFIGS, QStringList{}); if (auto defaultConfigPath = QCoreApplication::applicationDirPath() + "/SDKLauncherDefault.json"; QFile::exists(defaultConfigPath)) { this->loadGameConfig(defaultConfigPath); @@ -412,7 +413,7 @@ void Window::regenerateRecentConfigs() { } this->recent->addSeparator(); this->recent->addAction(tr("Clear"), [this] { - QSettings().setValue(STR_RECENT_CONFIGS, QStringList{}); + QSettings().remove(STR_RECENT_CONFIGS); this->regenerateRecentConfigs(); }); }