fix excepts

This commit is contained in:
lizzie 2026-05-20 14:42:07 +00:00
parent 60d5e9c9b2
commit 035caec801
2 changed files with 10 additions and 17 deletions

View file

@ -188,22 +188,16 @@ public:
this->SetValue(this->GetDefault()); this->SetValue(this->GetDefault());
return; return;
} }
try { if constexpr (std::is_same_v<Type, std::string>) {
if constexpr (std::is_same_v<Type, std::string>) { this->SetValue(input);
this->SetValue(input); } else if constexpr (std::is_same_v<Type, std::optional<u32>>) {
} else if constexpr (std::is_same_v<Type, std::optional<u32>>) { this->SetValue(u32(std::strtoul(input.c_str(), NULL, 10)));
this->SetValue(u32(std::stoul(input))); } else if constexpr (std::is_same_v<Type, bool>) {
} else if constexpr (std::is_same_v<Type, bool>) { this->SetValue(input == "true");
this->SetValue(input == "true"); } else if constexpr (std::is_same_v<Type, float>) {
} else if constexpr (std::is_same_v<Type, float>) { this->SetValue(std::strtof(input.c_str(), NULL));
this->SetValue(std::stof(input)); } else {
} else { this->SetValue(Type(std::strtoll(input.c_str(), NULL)));
this->SetValue(Type(std::stoll(input)));
}
} catch (std::invalid_argument&) {
this->SetValue(this->GetDefault());
} catch (std::out_of_range&) {
this->SetValue(this->GetDefault());
} }
} }

View file

@ -95,7 +95,6 @@ else()
-pedantic -pedantic
-Wno-missing-braces -Wno-missing-braces
-fno-rtti -fno-rtti
#-fno-exceptions
) )
if (CXX_GCC) if (CXX_GCC)
# GCC produces bogus -Warray-bounds warnings from xbyak headers for code paths that are not # GCC produces bogus -Warray-bounds warnings from xbyak headers for code paths that are not