From d88c7fee32b0f5a045967436f250ad8265fb9edf Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 5 Dec 2022 20:34:27 +0100 Subject: LibGfx+Userland: Make PNGWriter::encode() return ErrorOr 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. :^) --- Userland/Demos/Mandelbrot/Mandelbrot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Userland/Demos/Mandelbrot') 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 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()); -- cgit v1.2.3