mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibWeb: Verify optional argument has a value before static_cast-ing it
This commit is contained in:
parent
c00ce2fba0
commit
6d54e5ce9a
Notes:
sideshowbarker
2024-07-17 02:57:43 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/6d54e5ce9a Pull-request: https://github.com/SerenityOS/serenity/pull/16864 Reviewed-by: https://github.com/linusg
1 changed files with 1 additions and 1 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue