diff options
author | Tasuku Suzuki <tasuku@ptp.co.jp> | 2015-07-07 23:08:30 +0900 |
---|---|---|
committer | Tasuku Suzuki (PTP) <tasuku@ptp.co.jp> | 2015-07-24 02:55:54 +0000 |
commit | 38a9e94e0ee5ca8bf163fd3ed8d5d6e7fda31252 (patch) | |
tree | b6de15781e72e4c771c9f20de900bc12b0dfdca5 /src | |
parent | bd452c3d25778dc646b8f0aff70fa6a8c7e0ebcc (diff) |
add null check for qmlRegisterSingletonType()
When the callback passed to the function returns nullptr,
QQmlData::ensurePropertyCache(e, o) crashes.
Change-Id: I11efd7e9d6c5f18611e796d896384dd14a280303
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 41d44a821a..cb8c2bd3b5 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -225,6 +225,9 @@ void QQmlType::SingletonInstanceInfo::init(QQmlEngine *e) v4->pushGlobalContext(); QObject *o = qobjectCallback(e, e); setQObjectApi(e, o); + if (!o) { + qFatal("qmlRegisterSingletonType(): \"%s\" is not available because the callback function returns a null pointer.", qPrintable(typeName)); + } // if this object can use a property cache, create it now QQmlData::ensurePropertyCache(e, o); v4->popContext(); |