Ver Fonte

LibWeb: Replace incorrect empty Optional return with ByteBuffer

This function initially returned a ByteBuffer, so `return {}` was fine.
It was then changed to return Optional<ByteBuffer>, so we accidentally
started returning an empty Optional instead. Explicitly specify the
constructor name to fix this.

Thanks to DexesTTP for catching this!
Linus Groh há 3 anos atrás
pai
commit
5f993eecdb

+ 1 - 1
Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.cpp

@@ -105,7 +105,7 @@ Optional<ByteBuffer> get_buffer_source_copy(JS::Object const& buffer_source)
 
     // 7. If ! IsDetachedBuffer(esArrayBuffer) is true, then return the empty byte sequence.
     if (es_array_buffer->is_detached())
-        return {};
+        return ByteBuffer {};
 
     // 8. Let bytes be a new byte sequence of length equal to length.
     auto bytes = ByteBuffer::create_zeroed(length);