From 66606fd5cc6bd3d377cc35d9ce2e267b694410fc Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 24 Aug 2024 23:24:50 +0200 Subject: Catch Magick::Exception Prevent crash when trying to convert a file to png. This was a hard one. After checking into detached QT-Containers I finally realized that convertArchivefileToPng was the culprit, because ImageMagick::read exited with an "Unsupported marker type 0x09" execption. After some more investigation with convert, or magick convert these days, I found out that they could be ignored. Yes, it's a big hammer, but if it still fails after trying to convert, just return if still don't have a valid image. --- pictureviewer2.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pictureviewer2.cpp') diff --git a/pictureviewer2.cpp b/pictureviewer2.cpp index e56f52a..1e49bdf 100644 --- a/pictureviewer2.cpp +++ b/pictureviewer2.cpp @@ -449,6 +449,10 @@ void PictureViewer2::showFile(const PicData &file){ if(pixmap.isNull()){ if(fi.canonicalFilePath().startsWith(mArchiveDir)){ mCurPicData = Helper::convertArchivefileToPng(file); + if(mCurPicData.isEmpty()){ + //convert failed even though ignoring errors + return; + } mFiles[mCurPos] = mCurPicData; if(!mCurPicData.isEmpty()){ pixmap = QPixmap(mCurPicData.at(3).toString()); -- cgit v1.2.3-70-g09d2