Prevent crash in childAt when there are 0 children

Fix off-by-one error. QAccessibleInterface::child()
is 0-based, start the iteration at childCount() - 1.

Change-Id: I0c841b692adab0aae4e8ac44c7d308cd7a176ac8
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
Morten Johan Sorvig 2012-12-13 10:43:36 +01:00 committed by The Qt Project
parent 9a6366cead
commit abf95b7f77

View File

@ -165,7 +165,7 @@ QAccessibleMenuItem::~QAccessibleMenuItem()
QAccessibleInterface *QAccessibleMenuItem::childAt(int x, int y ) const
{
for (int i = childCount(); i >= 0; --i) {
for (int i = childCount() - 1; i >= 0; --i) {
QAccessibleInterface *childInterface = child(i);
if (childInterface->rect().contains(x,y)) {
return childInterface;