fix: Settings values being uninitialized by default
This commit is contained in:
parent
b31ae6e690
commit
ce1d581c3f
@ -51,6 +51,9 @@ namespace hex {
|
||||
if (!settings[unlocalizedCategory].contains(unlocalizedName))
|
||||
settings[unlocalizedCategory][unlocalizedName] = defaultValue;
|
||||
|
||||
if (settings[unlocalizedCategory][unlocalizedName].is_null())
|
||||
settings[unlocalizedCategory][unlocalizedName] = defaultValue;
|
||||
|
||||
return settings[unlocalizedCategory][unlocalizedName];
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user