diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp index 6546d01860..25bf3cbc5a 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp @@ -41,17 +41,12 @@ JS::Value WebAssemblyMemoryConstructor::construct(FunctionObject&) return {}; } - auto initial = initial_value.to_u32(global_object); - if (vm.exception()) - return {}; + auto initial = TRY_OR_DISCARD(initial_value.to_u32(global_object)); Optional<u32> maximum; - if (!maximum_value.is_empty()) { - maximum = maximum_value.to_u32(global_object); - if (vm.exception()) - return {}; - } + if (!maximum_value.is_empty()) + maximum = TRY_OR_DISCARD(maximum_value.to_u32(global_object)); auto address = WebAssemblyObject::s_abstract_machine.store().allocate(Wasm::MemoryType { Wasm::Limits { initial, maximum } }); if (!address.has_value()) { |