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.
This commit is contained in:
Jonathan White committed 2024-06-16 17:10:53 -04:00
1 parent f19d254a0c
commit c464f2bfe9
1 file changed
+1 -1
+1 -1
View File
@@ -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));