diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-06-07 11:37:49 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-10 04:26:03 +0000 |
commit | f12c07216e25f9a326000e45583b9d5216945ee7 (patch) | |
tree | a3c4defb16ff3a5ec2fda6f308f8de08a7ec9e1c /src/qml/qml/qqmlvmemetaobject.cpp | |
parent | 1e1a76b88192713bbdfd3b81f7310d496a644e9c (diff) |
Add an assert and simplify the code
QV4::QObjectWrapper::wrap will unconditionally dereference
the engine. So simply assert that there is an engine.
Fixes Coverity CID 10631.
Change-Id: Ia645e32813b351abce1df06cfb63ef8ef956b9a6
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmlvmemetaobject.cpp')
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index 15017a2572..20e3efd008 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -1218,8 +1218,9 @@ bool QQmlVMEMetaObject::ensureVarPropertiesAllocated() void QQmlVMEMetaObject::ensureQObjectWrapper() { - QQmlEnginePrivate *ep = (ctxt == 0 || ctxt->engine == 0) ? 0 : QQmlEnginePrivate::get(ctxt->engine); - QV4::ExecutionEngine *v4 = (ep == 0) ? 0 : ep->v4engine(); + Q_ASSERT(ctxt && ctxt->engine); + QQmlEnginePrivate *ep = QQmlEnginePrivate::get(ctxt->engine); + QV4::ExecutionEngine *v4 = ep->v4engine(); QV4::QObjectWrapper::wrap(v4, object); } |