summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-09-16 14:02:39 +0100
committerLinus Groh <mail@linusgroh.de>2021-09-16 22:34:24 +0100
commitfea27143e9db0812ed433372255214449d3cb8ab (patch)
tree5ce414175346f5f4c2024c8f9980984fcc7f40fb /Userland/Libraries/LibJS
parent5f0f0ac413ef561b005398756544dd22c4321b05 (diff)
downloadserenity-fea27143e9db0812ed433372255214449d3cb8ab.zip
LibJS: Initialize value in ThrowCompletionOr<void> default constructor
Otherwise, TRY() will crash when calling release_value() on the empty m_value Optional.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Completion.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Completion.h b/Userland/Libraries/LibJS/Runtime/Completion.h
index e84c9870c4..bf70d75ff2 100644
--- a/Userland/Libraries/LibJS/Runtime/Completion.h
+++ b/Userland/Libraries/LibJS/Runtime/Completion.h
@@ -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)