mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:47:34 +00:00
LibCrypto: Avoid creating bools from anything except bools
This commit is contained in:
parent
db8f0a2fa6
commit
ae49171755
1 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue