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 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 33ad8b6fa9afbe4b8612f26c0bad42d23d94e7b2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
0be4a0774a
commit
106ca7fb5d
@ -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…
x
Reference in New Issue
Block a user