QAbstractItemView: do not access invalid model indices (1/N)
Calling selectAll() on a view with an empty model, with the view in ContiguousSelection, causes an out of bounds access into the model. Guard the access. Change-Id: I3830a979bad760e9e1526c1c8b12d9767d41fc99 Pick-to: 5.15 6.2 6.3 Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
22ac61e62a
commit
33ad8b6fa9
@ -1213,7 +1213,8 @@ void QAbstractItemView::selectAll()
|
||||
break;
|
||||
case NoSelection:
|
||||
case ContiguousSelection:
|
||||
d->selectAll(selectionCommand(d->model->index(0, 0, d->root)));
|
||||
if (d->model->hasChildren(d->root))
|
||||
d->selectAll(selectionCommand(d->model->index(0, 0, d->root)));
|
||||
break;
|
||||
case SingleSelection:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user