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/Demos/Mandelbrot | |
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/Demos/Mandelbrot')
-rw-r--r-- | Userland/Demos/Mandelbrot/Mandelbrot.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Demos/Mandelbrot/Mandelbrot.cpp b/Userland/Demos/Mandelbrot/Mandelbrot.cpp index 2683956617..41a7a2cef7 100644 --- a/Userland/Demos/Mandelbrot/Mandelbrot.cpp +++ b/Userland/Demos/Mandelbrot/Mandelbrot.cpp @@ -377,7 +377,7 @@ ErrorOr<void> Mandelbrot::export_image(DeprecatedString const& export_path, Imag break; } case ImageType::PNG: - encoded_data = Gfx::PNGWriter::encode(m_set.bitmap()); + encoded_data = TRY(Gfx::PNGWriter::encode(m_set.bitmap())); break; case ImageType::QOI: encoded_data = Gfx::QOIWriter::encode(m_set.bitmap()); |