diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index fdd089e72d9..8d4d6d683d6 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -563,7 +563,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of else if (QAccessibleTableCellInterface *cell = iface->tableCellInterface()) rowIndex = cell->rowIndex(); Q_ASSERT(tableElement->rows); - if (rowIndex > int([tableElement->rows count])) + if (rowIndex > int([tableElement->rows count]) || rowIndex == -1) return nil; QMacAccessibilityElement *rowElement = tableElement->rows[rowIndex]; return NSAccessibilityUnignoredAncestor(rowElement);