Do not assert on invalid model index.

No need to crash here, just warn.
This will happen when asking a table for out of range indexes.

Change-Id: Ida83604bd587390a3b54fbed68f98dab8038c757
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
bb10
Frederik Gladhorn 2011-12-08 13:16:22 +01:00 committed by Qt by Nokia
parent 12dffdae75
commit 6651e4fae3
1 changed files with 2 additions and 6 deletions

View File

@ -224,7 +224,6 @@ QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const
{
Q_ASSERT(role() != QAccessible::Tree);
QModelIndex index = view->model()->index(row, column);
//Q_ASSERT(index.isValid());
if (!index.isValid()) {
qWarning() << "QAccessibleTable::cellAt: invalid index: " << index << " for " << view;
return 0;
@ -623,7 +622,8 @@ bool QAccessibleTree::selectRow(int row)
QAccessibleTableCell::QAccessibleTableCell(QAbstractItemView *view_, const QModelIndex &index_, QAccessible::Role role_)
: /* QAccessibleSimpleEditableTextInterface(this), */ view(view_), m_index(index_), m_role(role_)
{
Q_ASSERT(index_.isValid());
if (!index_.isValid())
qWarning() << "QAccessibleTableCell::QAccessibleTableCell with invalid index: " << index_;
}
void *QAccessibleTableCell::interface_cast(QAccessible::InterfaceType t)
@ -797,10 +797,6 @@ void QAccessibleTableCell::setText(QAccessible::Text /*t*/, const QString &text)
bool QAccessibleTableCell::isValid() const
{
if (!m_index.isValid()) {
qDebug() << "Interface is not valid";
}
return m_index.isValid();
}