From f3a58f3a5ab44be8af4de0496b55bc6a979d7b5a Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 1 Jun 2023 21:07:55 -0400 Subject: [PATCH] Ladybird: Simplify ImageCodecPluginLadybird a bit No behavior change. --- Ladybird/ImageCodecPluginLadybird.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Ladybird/ImageCodecPluginLadybird.cpp b/Ladybird/ImageCodecPluginLadybird.cpp index 134f3c145a6..1c1213a14e0 100644 --- a/Ladybird/ImageCodecPluginLadybird.cpp +++ b/Ladybird/ImageCodecPluginLadybird.cpp @@ -21,22 +21,15 @@ Optional ImageCodecPluginLadybird::decode_image(Rea return {}; } - bool had_errors = false; Vector frames; for (size_t i = 0; i < decoder->frame_count(); ++i) { auto frame_or_error = decoder->frame(i); - if (frame_or_error.is_error()) { - frames.append({ {}, 0 }); - had_errors = true; - } else { - auto frame = frame_or_error.release_value(); - frames.append({ move(frame.image), static_cast(frame.duration) }); - } + if (frame_or_error.is_error()) + return {}; + auto frame = frame_or_error.release_value(); + frames.append({ move(frame.image), static_cast(frame.duration) }); } - if (had_errors) - return {}; - return Web::Platform::DecodedImage { decoder->is_animated(), static_cast(decoder->loop_count()),