From 8bc76a2a88319154c227682a6f86413b5b56c816 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Wed, 3 Nov 2021 21:34:53 -0400 Subject: [PATCH] Prevent checking file hash with an empty path A warning is issued from Qt when the path is empty. This happens most often during test runs, but can also occur when closing a database before everything gets cleaned up. --- src/core/FileWatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/FileWatcher.cpp b/src/core/FileWatcher.cpp index e132b8954..1cf3be8e6 100644 --- a/src/core/FileWatcher.cpp +++ b/src/core/FileWatcher.cpp @@ -131,7 +131,7 @@ void FileWatcher::checkFileChanged() QByteArray FileWatcher::calculateChecksum() { QFile file(m_filePath); - if (file.open(QFile::ReadOnly)) { + if (!m_filePath.isEmpty() && file.open(QFile::ReadOnly)) { QCryptographicHash hash(QCryptographicHash::Sha256); if (m_fileChecksumSizeBytes > 0) { hash.addData(file.read(m_fileChecksumSizeBytes));