From 73fc89bb0dbe9a866e7b1cf47a42a85e5042fead Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 31 Jul 2018 14:39:06 +0200 Subject: QQmlTableInstanceModel: check if adaptormodel adapts AIM before using it The aim() function doesn't check if the model inside QQmlAdaptorModel is a actually a QAbstractItemModel (it just does a static cast). So we need to guard it. This is essentially the same fix as was done for QQmlDelegateModel (sha1: 9757d5f9c90988). Change-Id: I9f14e1639b5e7df4190333c679e805e7f9f7481a Reviewed-by: Mitch Curtis --- src/qml/types/qqmltableinstancemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/qml/types/qqmltableinstancemodel.cpp b/src/qml/types/qqmltableinstancemodel.cpp index dcad84cfb8..bab70ecaa6 100644 --- a/src/qml/types/qqmltableinstancemodel.cpp +++ b/src/qml/types/qqmltableinstancemodel.cpp @@ -314,7 +314,7 @@ void QQmlTableInstanceModel::setDelegate(QQmlComponent *delegate) const QAbstractItemModel *QQmlTableInstanceModel::abstractItemModel() const { - return m_adaptorModel.aim(); + return m_adaptorModel.adaptsAim() ? m_adaptorModel.aim() : nullptr; } // -------------------------------------------------------- -- cgit v1.2.3