diff options
author | Michal Klocek <michal.klocek@qt.io> | 2019-06-19 11:26:42 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2019-07-12 18:01:23 +0200 |
commit | a2e47fa8c90be25407268434f60114892c9e500a (patch) | |
tree | 390c7714173722a352a5ef2b0558306ef37abee8 | |
parent | 49d4da10920abbe46931e163e3b3d98614cad584 (diff) | |
download | qtwebengine-a2e47fa8c90be25407268434f60114892c9e500a.tar.gz |
Do not proceed with uninitialized resources
QRC files can be optimized with CONFIG+=qtquickcompiler
and removed, in that case 'size' of
resource is zero.
Do not process 'empty' resources. Throw warning.
Fixes: QTBUG-76403
Change-Id: If21ff698e7985f82e6456500d4d24cb366cff012
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r-- | src/core/net/url_request_qrc_job_qt.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/net/url_request_qrc_job_qt.cpp b/src/core/net/url_request_qrc_job_qt.cpp index a2712653d..4ac45e7c8 100644 --- a/src/core/net/url_request_qrc_job_qt.cpp +++ b/src/core/net/url_request_qrc_job_qt.cpp @@ -120,14 +120,14 @@ void URLRequestQrcJobQt::startGetHead() QMimeType mimeType = mimeDatabase.mimeTypeForFile(qrcFileInfo); m_mimeType = mimeType.name().toStdString(); // Open file - if (m_file.open(QIODevice::ReadOnly)) { + if (m_file.open(QIODevice::ReadOnly) && m_file.size() > 0) { m_remainingBytes = m_file.size(); set_expected_content_size(m_remainingBytes); // Notify that the headers are complete NotifyHeadersComplete(); - } else { - NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, ERR_INVALID_URL)); + return; } + qWarning("Resource %s not found or is empty", qUtf8Printable(qrcFilePath)); + NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, ERR_INVALID_URL)); } - } // namespace QtWebEngineCore |