LibCrypto: Avoid creating bools from anything except bools

This commit is contained in:
AnotherTest 2021-04-18 14:12:17 +04:30 committed by Andreas Kling
parent db8f0a2fa6
commit ae49171755
Notes: sideshowbarker 2024-07-18 19:27:40 +09:00

View File

@ -154,9 +154,13 @@ private:
if (value_or_error.is_error())
return value_or_error.error();
auto&& value = value_or_error.value();
if constexpr (requires { ValueType { value }; })
return ValueType { value };
if constexpr (IsSame<ValueType, bool> && !IsSame<DecodedType, bool>) {
return DecodeError::NonConformingType;
} else {
auto&& value = value_or_error.value();
if constexpr (requires { ValueType { value }; })
return ValueType { value };
}
return DecodeError::NonConformingType;
}