From 26022a4eee1041afc22b50c2786c8690c8f98c07 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 28 Sep 2012 19:22:13 +0200 Subject: [PATCH] Check for valid model and view in isValid for TableCells. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iadca5503ed2a1d6411d46ed6fe9d5b9a56461a3a Reviewed-by: Morten Johan Sørvig --- src/plugins/accessible/widgets/itemviews.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp index b3f0dc2a84..d4cfa8c823 100644 --- a/src/plugins/accessible/widgets/itemviews.cpp +++ b/src/plugins/accessible/widgets/itemviews.cpp @@ -713,7 +713,7 @@ void QAccessibleTableCell::setText(QAccessible::Text /*t*/, const QString &text) bool QAccessibleTableCell::isValid() const { - return m_index.isValid(); + return view && view->model() && m_index.isValid(); } QAccessibleInterface *QAccessibleTableCell::parent() const @@ -799,7 +799,8 @@ void QAccessibleTableHeaderCell::setText(QAccessible::Text, const QString &) bool QAccessibleTableHeaderCell::isValid() const { - return true; + return view && view->model() && (index > 0) + && ((orientation == Qt::Horizontal) ? (index < view->model()->columnCount()) : (index < view->model()->rowCount())); } QAccessibleInterface *QAccessibleTableHeaderCell::parent() const