Skip to content

Commit 8c80e07

Browse files
committed
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
1 parent 5b4aa9d commit 8c80e07

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Config.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@ with this program. If not, see <https://www.gnu.org/licenses/>
4949

5050
void Config::Load(json config)
5151
{
52+
// Only load from plugin config directory if there hasn't been a migration
5253
if (config.is_null()) {
5354
std::string configFilePath = Utils::Obs::StringHelper::GetModuleConfigPath(CONFIG_FILE_NAME);
5455
Utils::Json::GetJsonFileContent(configFilePath, config); // Fetch the existing config, which may not exist
5556
}
5657

57-
// Should never happen, but just in case
58-
if (!config.is_object())
59-
return;
58+
if (!config.is_object()) {
59+
blog(LOG_INFO, "[Config::Load] Existing configuration not found, using defaults.");
60+
config = json::object();
61+
}
6062

6163
if (config.contains(PARAM_FIRSTLOAD) && config[PARAM_FIRSTLOAD].is_boolean())
6264
FirstLoad = config[PARAM_FIRSTLOAD];

0 commit comments

Comments
 (0)