diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-01-20 17:18:17 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-24 22:36:09 +0100 |
commit | c388a879d73633b6ebe8353fd2a0407b908fe26f (patch) | |
tree | 3a09d39c87751105ace98936c8c210c57eee2fe8 /Userland/Libraries/LibWeb/Bindings/WindowObject.cpp | |
parent | f590cd1850027399ab7f0193ba97fa76b3a9cbab (diff) | |
download | serenity-c388a879d73633b6ebe8353fd2a0407b908fe26f.zip |
AK+Userland: Make AK::decode_base64 return ErrorOr
Diffstat (limited to 'Userland/Libraries/LibWeb/Bindings/WindowObject.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/WindowObject.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp index 85eaf2632d..88a20ab02a 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -340,7 +340,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::atob) return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountOne, "atob"); auto string = TRY(vm.argument(0).to_string(global_object)); auto decoded = decode_base64(StringView(string)); - if (!decoded.has_value()) + if (decoded.is_error()) return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::InvalidFormat, "Base64"); // decode_base64() returns a byte string. LibJS uses UTF-8 for strings. Use Latin1Decoder to convert bytes 128-255 to UTF-8. |