From e04cfc6f81a928213395bc73425d556dd5b212b4 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sat, 6 Jun 2026 04:25:17 +0000 Subject: [PATCH] fix for gamelist view enums --- src/common/settings_setting.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common/settings_setting.h b/src/common/settings_setting.h index a337df17f4..9b6ec76d62 100644 --- a/src/common/settings_setting.h +++ b/src/common/settings_setting.h @@ -102,7 +102,15 @@ public: * @param val The desired value */ virtual void SetValue(const Type& val) { - Type temp{ranged ? std::clamp(val, minimum, maximum) : val}; + // Enums have a maximal range which they're allowed + Type temp{}; + if constexpr (std::is_enum_v) { + auto const r_min = std::underlying_type_t(0); + auto const r_max = std::underlying_type_t(EnumMetadata::GetLast()); + temp = Type(std::clamp(std::underlying_type_t(val), r_min, r_max)); + } else { + temp = ranged ? std::clamp(val, this->minimum, this->maximum) : val; + } std::swap(value, temp); }