From 8c80e0745a8a603b17a120b406526c9b39e84436 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Wed, 5 Jun 2024 23:26:36 -0700 Subject: [PATCH] Config: Fix plugin startup for fresh installs The commit to migrate data from global.ini to the plugin_config folder accidentally broke plugin startup for fresh configurations. Instead of returning early if no configuration is found, simply generate a new one from defaults. Closes #1225 --- src/Config.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Config.cpp b/src/Config.cpp index 7af55b43..9c8d9cfe 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -49,14 +49,16 @@ with this program. If not, see void Config::Load(json config) { + // Only load from plugin config directory if there hasn't been a migration if (config.is_null()) { std::string configFilePath = Utils::Obs::StringHelper::GetModuleConfigPath(CONFIG_FILE_NAME); Utils::Json::GetJsonFileContent(configFilePath, config); // Fetch the existing config, which may not exist } - // Should never happen, but just in case - if (!config.is_object()) - return; + if (!config.is_object()) { + blog(LOG_INFO, "[Config::Load] Existing configuration not found, using defaults."); + config = json::object(); + } if (config.contains(PARAM_FIRSTLOAD) && config[PARAM_FIRSTLOAD].is_boolean()) FirstLoad = config[PARAM_FIRSTLOAD];