aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-06-26 16:10:11 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-06-26 16:22:30 +0200
commit9834ac56049408fbd848e364a82aabddc0815a07 (patch)
tree21b3e9d0b8ed2e6f4107c0f0ab26a24a9c272bbc /tools
parent0edfb718bb8bed6c4ed94859c8c2d4e9f6fa3847 (diff)
qmlscene: Avoid infinite loop
If the root document doesn't contain any executable code, we should terminate with an error message rather than loop forever. Change-Id: Ice2ff10ae5dc9d71df2d1c784597393695ab1d98 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlscene/main.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index ff31f63ed5..312b180df5 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -271,6 +271,10 @@ static bool checkVersion(const QUrl &url)
QTextStream stream(&f);
bool codeFound= false;
while (!codeFound) {
+ if (stream.atEnd()) {
+ fprintf(stderr, "qmlscene: no code found in file '%s'.\n", qPrintable(fileName));
+ return false;
+ }
QString line = stream.readLine();
if (line.contains(QLatin1Char('{'))) {
codeFound = true;
@@ -690,6 +694,8 @@ int main(int argc, char ** argv)
// QQuickView if one was created. That case is tracked by
// QPointer, so it is safe to delete the component here.
delete component;
+ } else {
+ exitCode = 1;
}
}