mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-17 23:12:22 +00:00
LibJS: Initialize value in ThrowCompletionOr<void> default constructor
Otherwise, TRY() will crash when calling release_value() on the empty m_value Optional.
This commit is contained in:
parent
5f0f0ac413
commit
fea27143e9
Notes:
sideshowbarker
2024-07-18 03:49:49 +09:00
Author: https://github.com/linusg
Commit: fea27143e9
Pull-request: https://github.com/SerenityOS/serenity/pull/10065
Reviewed-by: https://github.com/IdanHo ✅
1 changed files with 4 additions and 1 deletions
|
@ -97,7 +97,10 @@ private:
|
|||
template<typename ValueType>
|
||||
class [[nodiscard]] ThrowCompletionOr {
|
||||
public:
|
||||
ThrowCompletionOr() requires(IsSame<ValueType, Empty>) = default;
|
||||
ThrowCompletionOr() requires(IsSame<ValueType, Empty>)
|
||||
: m_value(Empty {})
|
||||
{
|
||||
}
|
||||
|
||||
// Not `explicit` on purpose so that `return vm.throw_completion<Error>(...);` is possible.
|
||||
ThrowCompletionOr(Completion throw_completion)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue