fix: Settings values being uninitialized by default

This commit is contained in:
WerWolv
2024-03-25 20:41:05 +01:00
parent b31ae6e690
commit ce1d581c3f
2 changed files with 5 additions and 2 deletions

View File

@@ -31,11 +31,11 @@ namespace hex::plugin::builtin {
for (const auto &[unlocalizedSubCategory, entries] : subCategories) {
for (const auto &[unlocalizedName, widget] : entries) {
try {
widget->load(ContentRegistry::Settings::impl::getSetting(unlocalizedCategory, unlocalizedName, widget->store()));
auto defaultValue = widget->store();
widget->load(ContentRegistry::Settings::impl::getSetting(unlocalizedCategory, unlocalizedName, defaultValue));
widget->onChanged();
} catch (const std::exception &e) {
log::error("Failed to load setting [{} / {}]: {}", unlocalizedCategory.get(), unlocalizedName.get(), e.what());
widget->store();
}
}
}