diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-14 19:40:49 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-14 21:02:14 +0200 |
commit | fa0e23009a81c13ce1920320cf6c6d3ecc94f44c (patch) | |
tree | 35f3a5b26e51ce5f090718e40433ef6089dc5f7a | |
parent | 3168a4afe8ffdf060b3e0d7e5f3322e4d5a91f2d (diff) | |
download | serenity-fa0e23009a81c13ce1920320cf6c6d3ecc94f44c.zip |
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.
-rw-r--r-- | Userland/Libraries/LibImageDecoderClient/Client.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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<DecodedImage> 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(); |