summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljscheck.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-05-30 17:38:10 +0200
committerThomas Hartmann <Thomas.Hartmann@theqtcompany.com>2016-05-31 08:11:25 +0000
commite49b0670c844b7a9e3f7113e724dbc72965f52a3 (patch)
tree7545fa3d1789184ddb9dbbdc9853f3e1bd022fa6 /src/libs/qmljs/qmljscheck.cpp
parent79733e5625faa44e013b74d625b1eb9214378e36 (diff)
downloadqt-creator-e49b0670c844b7a9e3f7113e724dbc72965f52a3.tar.gz
QmlJS: Don't crash if the type stack is empty
Change-Id: If4e0155e8167f3edee1890dee5fd8b19623bba17 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
Diffstat (limited to 'src/libs/qmljs/qmljscheck.cpp')
-rw-r--r--src/libs/qmljs/qmljscheck.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp
index 0199539517..e5fd12d6b9 100644
--- a/src/libs/qmljs/qmljscheck.cpp
+++ b/src/libs/qmljs/qmljscheck.cpp
@@ -1551,7 +1551,8 @@ bool Check::visit(CallExpression *ast)
// We have to allow the qsTr function for translation.
bool isTranslationFunction = (name == QLatin1String("qsTr") || name == QLatin1String("qsTrId"));
// allow adding connections with the help of the qt quick designer ui
- bool isDirectInConnectionsScope = m_typeStack.last() == QLatin1String("Connections");
+ bool isDirectInConnectionsScope =
+ (!m_typeStack.isEmpty() && m_typeStack.last() == QLatin1String("Connections"));
if (!isTranslationFunction && !isDirectInConnectionsScope)
addMessage(ErrFunctionsNotSupportedInQmlUi, location);