diff options
author | Chris Adams <christopher.adams@nokia.com> | 2012-06-12 17:47:15 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-12 14:10:24 +0200 |
commit | eacbc7805e937e64b7e117705919b214aed4f736 (patch) | |
tree | 5416f535f54bf67920acc4c673586e982c024a7e /src/qml/qml/qqmlglobal_p.h | |
parent | 38540f6091c2ffedaea3afbf093d8079840c9ea2 (diff) |
Check for null ptr in qmlobject_cast definition
Previously, the input object wasn't checked for nullness, and thus
the qmlobject_cast could assert.
Change-Id: I3552150953cef8411a860a381e28b1d681494b08
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlglobal_p.h')
-rw-r--r-- | src/qml/qml/qqmlglobal_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h index b52e55c61b..c237af6a7c 100644 --- a/src/qml/qml/qqmlglobal_p.h +++ b/src/qml/qml/qqmlglobal_p.h @@ -158,7 +158,7 @@ QT_BEGIN_NAMESPACE template<class T> T qmlobject_cast(QObject *object) { - if (QQmlMetaObject::canConvert(object, &reinterpret_cast<T>(object)->staticMetaObject)) + if (object && QQmlMetaObject::canConvert(object, &reinterpret_cast<T>(object)->staticMetaObject)) return static_cast<T>(object); else return 0; |