aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-11-28 09:18:36 +0100
committerUlf Hermann <ulf.hermann@qt.io>2022-11-29 12:32:27 +0100
commit4f8485796dc96af91dadeb9c266451528e6520b7 (patch)
tree9b79b0111e9c852a9ede8f4e8dbd08d9ab526576
parent8db714823ba60093c0380f9e2d0f612bd8dc8fcd (diff)
QmlCompiler: Check return code when opening qmltypes files
Coverity-Id: 403059 Change-Id: Ic45f749602f4230e8319d0c3d4c262043d2cdad4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
-rw-r--r--src/qmlcompiler/qqmljsimporter.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/qmlcompiler/qqmljsimporter.cpp b/src/qmlcompiler/qqmljsimporter.cpp
index c491e6d86e..a8fdc51ff5 100644
--- a/src/qmlcompiler/qqmljsimporter.cpp
+++ b/src/qmlcompiler/qqmljsimporter.cpp
@@ -58,7 +58,15 @@ void QQmlJSImporter::readQmltypes(
}
QFile file(filename);
- file.open(QFile::ReadOnly);
+ if (!file.open(QFile::ReadOnly)) {
+ m_warnings.append({
+ QStringLiteral("QML types file cannot be opened: ") + filename,
+ QtWarningMsg,
+ QQmlJS::SourceLocation()
+ });
+ return;
+ }
+
QQmlJSTypeDescriptionReader reader { filename, QString::fromUtf8(file.readAll()) };
QStringList dependencyStrings;
auto succ = reader(objects, &dependencyStrings);