mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +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())
|
if (value_or_error.is_error())
|
||||||
return value_or_error.error();
|
return value_or_error.error();
|
||||||
|
|
||||||
auto&& value = value_or_error.value();
|
if constexpr (IsSame<ValueType, bool> && !IsSame<DecodedType, bool>) {
|
||||||
if constexpr (requires { ValueType { value }; })
|
return DecodeError::NonConformingType;
|
||||||
return ValueType { value };
|
} else {
|
||||||
|
auto&& value = value_or_error.value();
|
||||||
|
if constexpr (requires { ValueType { value }; })
|
||||||
|
return ValueType { value };
|
||||||
|
}
|
||||||
|
|
||||||
return DecodeError::NonConformingType;
|
return DecodeError::NonConformingType;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue