summaryrefslogtreecommitdiff
path: root/Userland/Utilities/base64.cpp
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-01-20 17:18:17 +0000
committerAndreas Kling <kling@serenityos.org>2022-01-24 22:36:09 +0100
commitc388a879d73633b6ebe8353fd2a0407b908fe26f (patch)
tree3a09d39c87751105ace98936c8c210c57eee2fe8 /Userland/Utilities/base64.cpp
parentf590cd1850027399ab7f0193ba97fa76b3a9cbab (diff)
downloadserenity-c388a879d73633b6ebe8353fd2a0407b908fe26f.zip
AK+Userland: Make AK::decode_base64 return ErrorOr
Diffstat (limited to 'Userland/Utilities/base64.cpp')
-rw-r--r--Userland/Utilities/base64.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/Userland/Utilities/base64.cpp b/Userland/Utilities/base64.cpp
index 0febee2374..c612e39cea 100644
--- a/Userland/Utilities/base64.cpp
+++ b/Userland/Utilities/base64.cpp
@@ -46,12 +46,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio"));
if (decode) {
- auto decoded = decode_base64(StringView(buffer));
- if (!decoded.has_value()) {
- warnln("base64: invalid input");
- return 1;
- }
- fwrite(decoded.value().data(), sizeof(u8), decoded.value().size(), stdout);
+ auto decoded = TRY(decode_base64(StringView(buffer)));
+ fwrite(decoded.data(), sizeof(u8), decoded.size(), stdout);
return 0;
}