summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/FileAPI
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-01-06 19:12:42 +0100
committerLinus Groh <mail@linusgroh.de>2023-01-06 20:51:21 +0100
commit6d54e5ce9af5223f7b055383b666944856a3f2df (patch)
tree2541c2964667db3aec3d76d46b0abff881e8f71a /Userland/Libraries/LibWeb/FileAPI
parentc00ce2fba0870fb25074216a86dd7888d2e0db35 (diff)
downloadserenity-6d54e5ce9af5223f7b055383b666944856a3f2df.zip
LibWeb: Verify optional argument has a value before static_cast-ing it
Diffstat (limited to 'Userland/Libraries/LibWeb/FileAPI')
-rw-r--r--Userland/Libraries/LibWeb/FileAPI/File.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/FileAPI/File.cpp b/Userland/Libraries/LibWeb/FileAPI/File.cpp
index 52f4297189..75b3940a6c 100644
--- a/Userland/Libraries/LibWeb/FileAPI/File.cpp
+++ b/Userland/Libraries/LibWeb/FileAPI/File.cpp
@@ -24,7 +24,7 @@ File::~File() = default;
WebIDL::ExceptionOr<JS::NonnullGCPtr<File>> File::create(JS::Realm& realm, Vector<BlobPart> const& file_bits, DeprecatedString const& file_name, Optional<FilePropertyBag> const& options)
{
// 1. Let bytes be the result of processing blob parts given fileBits and options.
- auto bytes = TRY_OR_RETURN_OOM(realm, process_blob_parts(file_bits, static_cast<Optional<BlobPropertyBag> const&>(*options)));
+ auto bytes = TRY_OR_RETURN_OOM(realm, process_blob_parts(file_bits, options.has_value() ? static_cast<BlobPropertyBag const&>(*options) : Optional<BlobPropertyBag> {}));
// 2. Let n be the fileName argument to the constructor.
// NOTE: Underlying OS filesystems use differing conventions for file name; with constructed files, mandating UTF-16 lessens ambiquity when file names are converted to byte sequences.