mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-05 09:06:08 +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: ae49171755
Pull-request: https://github.com/SerenityOS/serenity/pull/6443
Reviewed-by: https://github.com/awesomekling
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();
|
||||||
|
|
||||||
|
if constexpr (IsSame<ValueType, bool> && !IsSame<DecodedType, bool>) {
|
||||||
|
return DecodeError::NonConformingType;
|
||||||
|
} else {
|
||||||
auto&& value = value_or_error.value();
|
auto&& value = value_or_error.value();
|
||||||
if constexpr (requires { ValueType { value }; })
|
if constexpr (requires { ValueType { value }; })
|
||||||
return ValueType { value };
|
return ValueType { value };
|
||||||
|
}
|
||||||
|
|
||||||
return DecodeError::NonConformingType;
|
return DecodeError::NonConformingType;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue