summaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index 274e04822..aab06d8b1 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -819,10 +819,13 @@ QByteArray hashFile(const QString filename)
{
QCryptographicHash hash(QCryptographicHash::Sha1);
QFile imagefile(filename);
- imagefile.open(QIODevice::ReadOnly);
- hash.addData(&imagefile);
- add_hash(filename, hash.result());
- return hash.result();
+ if (imagefile.open(QIODevice::ReadOnly)) {
+ hash.addData(&imagefile);
+ add_hash(filename, hash.result());
+ return hash.result();
+ } else {
+ return QByteArray();
+ }
}
void learnHash(struct picture *picture, QByteArray hash)