diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-01-20 17:01:39 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-24 22:36:09 +0100 |
commit | f590cd1850027399ab7f0193ba97fa76b3a9cbab (patch) | |
tree | c081315ec020ff956bd8cc62ab2549def75bcc9e /Userland/Libraries/LibPDF | |
parent | 45cf40653a03dab11c0739783446ff696a9a5b0a (diff) | |
download | serenity-f590cd1850027399ab7f0193ba97fa76b3a9cbab.zip |
AK+Userland: Make AK::decode_hex() return ErrorOr
This lets us propagate the reason why it failed up to the caller. :^)
Diffstat (limited to 'Userland/Libraries/LibPDF')
-rw-r--r-- | Userland/Libraries/LibPDF/Filter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Libraries/LibPDF/Filter.cpp b/Userland/Libraries/LibPDF/Filter.cpp index f5c15fa326..929f78ffca 100644 --- a/Userland/Libraries/LibPDF/Filter.cpp +++ b/Userland/Libraries/LibPDF/Filter.cpp @@ -39,8 +39,12 @@ Optional<ByteBuffer> Filter::decode(ReadonlyBytes bytes, FlyString const& encodi Optional<ByteBuffer> Filter::decode_ascii_hex(ReadonlyBytes bytes) { - if (bytes.size() % 2 == 0) - return decode_hex(bytes); + if (bytes.size() % 2 == 0) { + auto decode_result = decode_hex(bytes); + if (decode_result.is_error()) + return {}; + return decode_result.release_value(); + } // FIXME: Integrate this padding into AK/Hex? |