diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-03-09 11:14:13 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-03-09 11:45:50 +0000 |
commit | 2615c85297520299528b40404f729ade47087f80 (patch) | |
tree | 3d836f6d7b698a79bb551980b0d524206a6efefb | |
parent | 01d076d0e81e5d8825fcdc16544f826530bd5ace (diff) |
QQuickSpinBox: add missing null check
In auto tests, the engine might be null during destruction.
Change-Id: I0556c746f6c47198afc937da052106d3f8c35558
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
-rw-r--r-- | src/templates/qquickspinbox.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/templates/qquickspinbox.cpp b/src/templates/qquickspinbox.cpp index 255715e1..64c94e7a 100644 --- a/src/templates/qquickspinbox.cpp +++ b/src/templates/qquickspinbox.cpp @@ -131,10 +131,13 @@ void QQuickSpinBoxPrivate::updateValue() if (contentItem) { QVariant text = contentItem->property("text"); if (text.isValid()) { - QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(qmlEngine(q)); - QJSValue loc(v4, QQmlLocale::wrap(v4, locale)); - QJSValue val = q->valueFromText().call(QJSValueList() << text.toString() << loc); - q->setValue(val.toInt()); + QQmlEngine *engine = qmlEngine(q); + if (engine) { + QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine); + QJSValue loc(v4, QQmlLocale::wrap(v4, locale)); + QJSValue val = q->valueFromText().call(QJSValueList() << text.toString() << loc); + q->setValue(val.toInt()); + } } } } |