From aa361e8600aa2e3f83133aff9a12264128f7927c Mon Sep 17 00:00:00 2001 From: lizzie Date: Wed, 12 Aug 2026 16:13:10 +0000 Subject: [PATCH] bring back evil strings --- src/common/settings_setting.h | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/common/settings_setting.h b/src/common/settings_setting.h index a6fc88c0a3..0a9243cc0d 100644 --- a/src/common/settings_setting.h +++ b/src/common/settings_setting.h @@ -195,16 +195,22 @@ public: this->SetValue(this->GetDefault()); return; } - if constexpr (std::is_same_v) { - this->SetValue(input); - } else if constexpr (std::is_same_v>) { - this->SetValue(u32(std::strtoul(input.c_str(), nullptr, 10))); - } else if constexpr (std::is_same_v) { - this->SetValue(input == "true"); - } else if constexpr (std::is_same_v) { - this->SetValue(std::strtof(input.c_str(), nullptr)); - } else { - this->SetValue(Type(std::strtoll(input.c_str(), nullptr, 10))); + try { + if constexpr (std::is_same_v) { + this->SetValue(input); + } else if constexpr (std::is_same_v>) { + this->SetValue(u32(std::stoul(input))); + } else if constexpr (std::is_same_v) { + this->SetValue(input == "true"); + } else if constexpr (std::is_same_v) { + this->SetValue(std::stof(input)); + } else { + this->SetValue(Type(std::stoll(input))); + } + } catch (std::invalid_argument&) { + this->SetValue(this->GetDefault()); + } catch (std::out_of_range&) { + this->SetValue(this->GetDefault()); } }