Accessibility: Check for valid range of tree items.

This might lead to crashes otherwise.

Change-Id: Ib28ac03b7d200571a0e759467eb692cfee3b05f3
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
This commit is contained in:
Frederik Gladhorn 2012-04-13 15:30:52 +02:00 committed by Qt by Nokia
parent d64ad022f3
commit c65a558e00

View File

@ -401,6 +401,10 @@ QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
return QModelIndex();
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
if (treeView->d_func()->viewItems.count() <= row) {
qWarning() << "QAccessibleTree::indexFromLogical: invalid index: " << row << column << " for " << treeView;
return QModelIndex();
}
QModelIndex modelIndex = treeView->d_func()->viewItems.at(row).index;
if (modelIndex.isValid() && column > 0) {