Return earlier if script.context() is invalid
authorCharles Yin <charles.yin@nokia.com>
Wed, 9 May 2012 01:50:47 +0000 (11:50 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 9 May 2012 02:36:41 +0000 (04:36 +0200)
If script.context() is invalid, the qml expression is invalid too,
so no need to continue contructing the expression at all.

Change-Id: I5a34cf0eb1c2cc0b2bba7eed736073050f3240e9
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
src/qml/qml/qqmlexpression.cpp

index 67a1195..c333df1 100644 (file)
@@ -216,6 +216,10 @@ QQmlExpression::QQmlExpression(const QQmlScriptString &script, QObject *parent)
 : QObject(*new QQmlExpressionPrivate, parent)
 {
     Q_D(QQmlExpression);
+
+    if (!script.context()->isValid())
+        return;
+
     bool defaultConstruction = false;
 
     int id = script.d.data()->bindingId;