summaryrefslogtreecommitdiffstats
path: root/src/plugins/accessible
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2012-04-13 13:30:52 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-04-13 17:36:51 (GMT)
commit8f0b5470a96b342faa96ebe133dce5dc679f13b7 (patch)
tree632945321388bb1806ff8377433022c30c130607 /src/plugins/accessible
parent282951bc6c7ddb607fb7ebf61eb8de9acf3da77f (diff)
downloadQt-8f0b5470a96b342faa96ebe133dce5dc679f13b7.zip
Qt-8f0b5470a96b342faa96ebe133dce5dc679f13b7.tar.gz
Qt-8f0b5470a96b342faa96ebe133dce5dc679f13b7.tar.bz2
Fix crashes in QAccessibleTree::navigate
It's a best practice to return 0 when the iface is invalid. Change-Id: I6dd70b53b975b10b75c246e6f8f7681da2bcb785 Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/plugins/accessible')
-rw-r--r--src/plugins/accessible/widgets/itemviews.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp
index 96da49a..c2e1c52 100644
--- a/src/plugins/accessible/widgets/itemviews.cpp
+++ b/src/plugins/accessible/widgets/itemviews.cpp
@@ -488,10 +488,14 @@ bool QAccessibleTable2::doAction(int, int, const QVariantList &)
QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
{
- if (!view())
+ if (!isValid())
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) {
@@ -585,11 +589,13 @@ int QAccessibleTree::navigate(RelationFlag relation, int index, QAccessibleInter
*iface = cell(modelIndex);
return 0;
}
+ *iface = 0;
return -1;
}
default:
break;
}
+ // handle everything except child
return QAccessibleTable2::navigate(relation, index, iface);
}