mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
LibCrypto: Avoid creating bools from anything except bools
This commit is contained in:
parent
db8f0a2fa6
commit
ae49171755
Notes:
sideshowbarker
2024-07-18 19:27:40 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/ae491717558 Pull-request: https://github.com/SerenityOS/serenity/pull/6443 Reviewed-by: https://github.com/awesomekling
|
@ -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…
Reference in a new issue