diff options
Diffstat (limited to 'src/widgets/dialogs/qfilesystemmodel.cpp')
-rw-r--r-- | src/widgets/dialogs/qfilesystemmodel.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index bf14b5c6fd..179c5861c9 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -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); |