From fa0e23009a81c13ce1920320cf6c6d3ecc94f44c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 14 May 2021 19:40:49 +0200 Subject: [PATCH] LibImageDecoderClient: Decoded images with 0 frames are not successful Previously you could pass anything (e.g a text file) to ImageDecoder and it would "succeed" in decoding it and give you back a 0-frame result. Let's consider that state a failure instead. --- Userland/Libraries/LibImageDecoderClient/Client.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibImageDecoderClient/Client.cpp b/Userland/Libraries/LibImageDecoderClient/Client.cpp index 2df07a893a..178502ce7f 100644 --- a/Userland/Libraries/LibImageDecoderClient/Client.cpp +++ b/Userland/Libraries/LibImageDecoderClient/Client.cpp @@ -51,6 +51,9 @@ Optional Client::decode_image(const ByteBuffer& encoded_data) auto& response = response_or_error.value(); + if (response.bitmaps().is_empty()) + return {}; + DecodedImage image; image.is_animated = response.is_animated(); image.loop_count = response.loop_count();