summaryrefslogtreecommitdiffstats
path: root/newpicsdialog.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2024-06-17 23:47:28 +0200
committerArno <arno@disconnect.de>2024-06-17 23:51:47 +0200
commitc7b0d2967acf2430aabfda4910e77f4cf4827f55 (patch)
tree997f14d81364a20e5eb7ad067229b0a2d7b3c6c8 /newpicsdialog.cpp
parent0690a2ae537aa1c6058996116c5af8bac66fc4ee (diff)
downloadSheMov-c7b0d2967acf2430aabfda4910e77f4cf4827f55.tar.gz
SheMov-c7b0d2967acf2430aabfda4910e77f4cf4827f55.tar.bz2
SheMov-c7b0d2967acf2430aabfda4910e77f4cf4827f55.zip
Fix crash when trying to read an invalid image
Helper::picSize assumed that all data passed to it is a valid image and thus crashed with an exception. Wrap it into try - catch and return QVariant() when the pic is invalid.
Diffstat (limited to 'newpicsdialog.cpp')
-rw-r--r--newpicsdialog.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/newpicsdialog.cpp b/newpicsdialog.cpp
index baaed8f..e7e963b 100644
--- a/newpicsdialog.cpp
+++ b/newpicsdialog.cpp
@@ -354,6 +354,9 @@ void NewPicFilesModel::addFile(const QString &path){
return;
}
QVariant picSize = Helper::picSize(fi.absoluteFilePath());
+ if(picSize == QVariant()){
+ return;
+ }
insertRows(0, 1, QModelIndex());
QModelIndex inserted = index(0, 1, QModelIndex());
setData(inserted, fi.fileName(), FileNameRole);