1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:47:46 +00:00

Userland: Return empty if ImageDecoder client receives an invalid frame

This simplifies error checking for all the users of the ImageDecoder
client.
This commit is contained in:
Tim Ledbetter 2023-10-01 19:56:19 +01:00 committed by Andreas Kling
parent e6c1429311
commit eaa6304aab
6 changed files with 11 additions and 15 deletions

View file

@ -31,9 +31,7 @@ Optional<Web::Platform::DecodedImage> ImageCodecPluginSerenity::decode_image(Rea
decoded_image.is_animated = result.is_animated;
decoded_image.loop_count = result.loop_count;
for (auto const& frame : result.frames) {
if (!frame.bitmap)
return {};
decoded_image.frames.empend(move(frame.bitmap), frame.duration);
decoded_image.frames.empend(frame.bitmap, frame.duration);
}
return decoded_image;