Skip to content

Commit 39afac5

Browse files
lichaofan2008deepin-bot[bot]
authored andcommitted
fix: issue of corrupted PNG file.
Some corrupted PNG files will trigger error messages during parsing, but data is still read from them, and we process them following the normal procedure. 某些已损坏的PNG文件解析时会报错,但同时也读取到了数据,我们按正常流程处理。 Bug: https://pms.uniontech.com//bug-view-346475.html
1 parent 3ba0572 commit 39afac5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

libimageviewer/unionimage/unionimage.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,13 @@ UNIONIMAGESHARED_EXPORT bool loadStaticImageFromFile(const QString &path, QImage
274274
QImage try_res;
275275
readerF.setAutoTransform(true);
276276
if (readerF.canRead()) {
277-
try_res = readerF.read();
277+
qInfo() << "img can read, file:" << path;
278+
// 某些已损坏的PNG文件这里会返回false,但同时也读取到了数据,我们按正常流程处理
279+
if (readerF.read(&try_res)) {
280+
qInfo() << "img read success after can read, file:" << path;
281+
} else {
282+
qWarning() << "img read failed after can read, file:" << path;
283+
}
278284
} else {
279285
errorMsg = "can't read image:" + readerF.errorString() + format;
280286
try_res = QImage(path);

0 commit comments

Comments
 (0)