mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Fix default value for Enums when the key is missing.
This commit is contained in:
parent
aa59eae8c8
commit
8c44d62ed9
1 changed files with 10 additions and 3 deletions
|
|
@ -281,9 +281,16 @@ public:
|
|||
}
|
||||
else if constexpr (std::is_enum_v<T>)
|
||||
{
|
||||
auto it = EnumTemplate->begin();
|
||||
|
||||
Value = EnumTemplate->at(section[Name].value_or<std::string>(static_cast<std::string>(it->first)));
|
||||
std::string value = section[Name].value_or(std::string());
|
||||
auto it = EnumTemplate->find(value);
|
||||
if (it != EnumTemplate->end())
|
||||
{
|
||||
Value = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
Value = DefaultValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue