From eacbc7805e937e64b7e117705919b214aed4f736 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Tue, 12 Jun 2012 17:47:15 +1000 Subject: 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 Reviewed-by: Aaron Kennedy --- src/qml/qml/qqmlglobal_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/qml/qqmlglobal_p.h') 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 T qmlobject_cast(QObject *object) { - if (QQmlMetaObject::canConvert(object, &reinterpret_cast(object)->staticMetaObject)) + if (object && QQmlMetaObject::canConvert(object, &reinterpret_cast(object)->staticMetaObject)) return static_cast(object); else return 0; -- cgit v1.2.3