From 52a7f472b06916e4f4d4f00a9ed0aede9a3e6816 Mon Sep 17 00:00:00 2001 From: Doris Verria Date: Tue, 13 Oct 2020 11:30:32 +0200 Subject: Return false from canFetchMore for uninitialized QFileSystem models Task-number: QTBUG-87273 Change-Id: I1787e3dd26ec10cf161d8fa4e329972b6dd4aa6c Reviewed-by: Volker Hilsheimer (cherry picked from commit 61dee37d667e083fd2979ecc166efbc1bfcaf0e7) --- src/widgets/dialogs/qfilesystemmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 4644f0f04e..0db06e9b71 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -644,6 +644,8 @@ bool QFileSystemModel::hasChildren(const QModelIndex &parent) const bool QFileSystemModel::canFetchMore(const QModelIndex &parent) const { Q_D(const QFileSystemModel); + if (!d->setRootPath) + return false; const QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent); return (!indexNode->populatedChildren); } -- cgit v1.2.3