diff --git a/Ladybird/ImageCodecPluginLadybird.cpp b/Ladybird/ImageCodecPluginLadybird.cpp index 134f3c145a..1c1213a14e 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()),