diff options
author | Andreas Kling <kling@serenityos.org> | 2022-12-05 20:34:27 +0100 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-12-08 13:01:11 +0000 |
commit | d88c7fee32b0f5a045967436f250ad8265fb9edf (patch) | |
tree | 3859704ee07f50502ad6055e6931c0b20fdecbe0 /Userland/Services | |
parent | 95b4ffad39d4538dd1a098eda3470b61177b23c1 (diff) | |
download | serenity-d88c7fee32b0f5a045967436f250ad8265fb9edf.zip |
LibGfx+Userland: Make PNGWriter::encode() return ErrorOr<ByteBuffer>
This is a first step towards handling PNG encoding failures instead of
just falling over and crashing the program.
This initial step will cause encode() to return an error if the final
ByteBuffer copy fails to allocate. There are more potential failures
that will be surfaced by subsequent commits.
Two FIXMEs were killed in the making of this patch. :^)
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/SpiceAgent/SpiceAgent.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Services/SpiceAgent/SpiceAgent.cpp b/Userland/Services/SpiceAgent/SpiceAgent.cpp index c9bb4a1eeb..da0f97a92b 100644 --- a/Userland/Services/SpiceAgent/SpiceAgent.cpp +++ b/Userland/Services/SpiceAgent/SpiceAgent.cpp @@ -79,7 +79,7 @@ void SpiceAgent::on_message_received() ReadonlyBytes bytes; if (mime == "image/x-serenityos") { auto bitmap = m_clipboard_connection.get_bitmap(); - backing_byte_buffer = Gfx::PNGWriter::encode(*bitmap); + backing_byte_buffer = MUST(Gfx::PNGWriter::encode(*bitmap)); bytes = backing_byte_buffer; } else { auto data = clipboard.data(); |