a11y atspi: Add null check in GetRowHeader handling

Just like the GetColumnHeader case already does, check
that the cell isn't nullptr before trying to retrieve
the table cell interface from it.

(Not doing so e.g. resulted in a crash with WIP branches
of LibreOffice and Orca to make selected cells with a
child index not fitting into 32 bit work, s.a.
https://bugs.documentfoundation.org/show_bug.cgi?id=150683 )

Pick-to: 6.4 6.3
Change-Id: Idd55fd1f0c49b616c732ddb683814605a46ff319
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Michael Weghorn 2022-09-02 08:29:47 +02:00
parent b4a5f0c57c
commit 5462485a59

View File

@ -2506,9 +2506,9 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString
} else if (function == "GetRowHeader"_L1) {
int row = message.arguments().at(0).toInt();
QSpiObjectReference ref;
QAccessibleTableCellInterface *cell = interface->tableInterface()->cellAt(row, 0)->tableCellInterface();
if (cell) {
QList<QAccessibleInterface*> header = cell->rowHeaderCells();
QAccessibleInterface *cell = interface->tableInterface()->cellAt(row, 0);
if (cell && cell->tableCellInterface()) {
QList<QAccessibleInterface*> header = cell->tableCellInterface()->rowHeaderCells();
if (header.size() > 0) {
ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(header.takeAt(0))));
}