QAbstractItemView: do not access invalid model indices (2/N)

Similar to the parent patch, the private selectAll() was doing
two out of bounds accesses on an empty model. Guard it.

Change-Id: If0f3ce1e6c44a152791313e47db79985e71ef955
Pick-to: 5.15 6.2 6.3
Reviewed-by: David Faure <david.faure@kdab.com>
bb10
Giuseppe D'Angelo 2022-01-27 09:47:59 +01:00
parent 33ad8b6fa9
commit 035babe502
1 changed files with 2 additions and 0 deletions

View File

@ -4623,6 +4623,8 @@ void QAbstractItemViewPrivate::selectAll(QItemSelectionModel::SelectionFlags com
{
if (!selectionModel)
return;
if (!model->hasChildren(root))
return;
QItemSelection selection;
QModelIndex tl = model->index(0, 0, root);