mirror of https://github.com/qt/qtbase.git
QFileSystemModel::index(): Add a list size check
This prevents an out of range assert when monitoring directory with activity (for example, temp). Task-number: QTBUG-62841 Change-Id: Id3aa4098e9bbd665c7b17a667516885fa7c7f473 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Martin Rotter <rotter.martinos@gmail.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
b8a6e2b6e8
commit
77687bc64e
|
@ -260,7 +260,10 @@ QModelIndex QFileSystemModel::index(int row, int column, const QModelIndex &pare
|
|||
Q_ASSERT(parentNode);
|
||||
|
||||
// now get the internal pointer for the index
|
||||
const QString &childName = parentNode->visibleChildren.at(d->translateVisibleLocation(parentNode, row));
|
||||
const int i = d->translateVisibleLocation(parentNode, row);
|
||||
if (i >= parentNode->visibleChildren.size())
|
||||
return QModelIndex();
|
||||
const QString &childName = parentNode->visibleChildren.at(i);
|
||||
const QFileSystemModelPrivate::QFileSystemNode *indexNode = parentNode->children.value(childName);
|
||||
Q_ASSERT(indexNode);
|
||||
|
||||
|
|
Loading…
Reference in New Issue