From 1e0a6b31603fdb95232e8210512c9ad92ef372af Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 15 Jan 2024 15:15:12 +0100 Subject: [PATCH] QCocoaA(11)y: do not try to access an element if rowIndex == -1 This ends up in out of bounds exception. Pick-to: 6.6 6.6.2 6.5 Fixes: QTBUG-120469 Fixes: QTBUG-121008 Change-Id: Id895f311bbb59a3734ecadd0d2472a4018332e16 Reviewed-by: Volker Hilsheimer (cherry picked from commit 75a918d487aabacd2d377e1e79baea7d30deb5ac) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);