From 61dee37d667e083fd2979ecc166efbc1bfcaf0e7 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 Pick-to: 5.15 Change-Id: I1787e3dd26ec10cf161d8fa4e329972b6dd4aa6c Reviewed-by: Volker Hilsheimer --- src/gui/itemmodels/qfilesystemmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/itemmodels/qfilesystemmodel.cpp') diff --git a/src/gui/itemmodels/qfilesystemmodel.cpp b/src/gui/itemmodels/qfilesystemmodel.cpp index 481f11162a..bb9a5a1d43 100644 --- a/src/gui/itemmodels/qfilesystemmodel.cpp +++ b/src/gui/itemmodels/qfilesystemmodel.cpp @@ -638,6 +638,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