Check return value of 'virtual bool QFile::open(QIODeviceBase::OpenMode)'

Signed-off-by: Dylan Schooner <dschooner05@gmail.com>
This commit is contained in:
Dylan Schooner
2025-10-30 03:15:14 -04:00
parent 2982e6e7c9
commit 8d42bdaf6b
9 changed files with 63 additions and 28 deletions

View File

@@ -112,7 +112,10 @@ auto HttpMetaCache::resolveEntry(QString base, QString resource_path, QString ex
qint64 file_last_changed = finfo.lastModified().toUTC().toMSecsSinceEpoch();
if (file_last_changed != entry->m_local_changed_timestamp) {
QFile input(real_path);
input.open(QIODevice::ReadOnly);
if (!input.open(QIODevice::ReadOnly)) {
qWarning() << "Failed to open file '" << input.fileName() << "' for reading!";
return staleEntry(base, resource_path);
}
QString md5sum = QCryptographicHash::hash(input.readAll(), QCryptographicHash::Md5).toHex().constData();
if (entry->m_md5sum != md5sum) {
selected_base.entry_list.remove(resource_path);