mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-30 05:05:10 +00:00
LibGfx/WebPLoader: Survive calling loop_count() before other accessors
Fixes `animation` asserting when reading a webp input. (The other order of operations is still covered by TestImageWriter.cpp.)
This commit is contained in:
parent
de883d6621
commit
857750dfed
|
@ -1381,9 +1381,9 @@ TEST_CASE(test_webp_extended_lossless_animated)
|
|||
EXPECT(Gfx::WebPImageDecoderPlugin::sniff(file->bytes()));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::WebPImageDecoderPlugin::create(file->bytes()));
|
||||
|
||||
EXPECT_EQ(plugin_decoder->loop_count(), 42u);
|
||||
EXPECT_EQ(plugin_decoder->frame_count(), 8u);
|
||||
EXPECT(plugin_decoder->is_animated());
|
||||
EXPECT_EQ(plugin_decoder->loop_count(), 42u);
|
||||
|
||||
EXPECT_EQ(plugin_decoder->size(), Gfx::IntSize(990, 1050));
|
||||
|
||||
|
|
|
@ -639,6 +639,11 @@ size_t WebPImageDecoderPlugin::loop_count()
|
|||
if (!is_animated())
|
||||
return 0;
|
||||
|
||||
if (m_context->state < WebPLoadingContext::State::ChunksDecoded) {
|
||||
if (set_error(decode_webp_chunks(*m_context)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m_context->state < WebPLoadingContext::State::AnimationFrameChunksDecoded) {
|
||||
if (set_error(decode_webp_animation_frame_chunks(*m_context)))
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue