diff --git a/src/plugins/imageformats/webp/qwebphandler.cpp b/src/plugins/imageformats/webp/qwebphandler.cpp index 0bd89f6fad7f07e5f245bc637fd1699c9fbd584c..5a0ae4ad45ac5d7f2f0ffcfaca4da24f473cba01 100644 --- a/src/plugins/imageformats/webp/qwebphandler.cpp +++ b/src/plugins/imageformats/webp/qwebphandler.cpp @@ -74,6 +74,10 @@ bool QWebpHandler::canRead() const if (m_scanState != ScanError) { setFormat(QByteArrayLiteral("webp")); + + if (m_features.has_animation && m_iter.frame_num >= m_frameCount) + return false; + return true; } return false; diff --git a/tests/auto/webp/tst_qwebp.cpp b/tests/auto/webp/tst_qwebp.cpp index d1d30dbefe1b7cbc99933f5c947d7910bb9faf48..ad4a376b53da73f7588710c6d13d357b7270cdee 100644 --- a/tests/auto/webp/tst_qwebp.cpp +++ b/tests/auto/webp/tst_qwebp.cpp @@ -127,6 +127,7 @@ void tst_qwebp::readAnimation() } QVERIFY(reader.read().isNull()); + QCOMPARE(reader.canRead(), !reader.supportsAnimation()); } void tst_qwebp::writeImage_data()