From c2bdb67ea93327ceb06b04dc3083d350d5694dc2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 20 Aug 2017 14:15:28 -0600 Subject: Avoid warning messages --- framework/src/domain/folderlistmodel.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'framework/src/domain/folderlistmodel.cpp') diff --git a/framework/src/domain/folderlistmodel.cpp b/framework/src/domain/folderlistmodel.cpp index 1fe2abe6..c25e8bd6 100644 --- a/framework/src/domain/folderlistmodel.cpp +++ b/framework/src/domain/folderlistmodel.cpp @@ -33,12 +33,14 @@ FolderListModel::FolderListModel(QObject *parent) : KRecursiveFilterProxyModel() //Automatically fetch all folders, otherwise the recursive filtering does not work. QObject::connect(this, &QSortFilterProxyModel::sourceModelChanged, [this] () { - QObject::connect(sourceModel(), &QAbstractItemModel::rowsInserted, sourceModel(), [this] (QModelIndex parent, int first, int last) { - for (int row = first; row <= last; row++) { - auto idx = sourceModel()->index(row, 0, parent); - sourceModel()->fetchMore(idx); - } - }); + if (sourceModel()) { + QObject::connect(sourceModel(), &QAbstractItemModel::rowsInserted, sourceModel(), [this] (QModelIndex parent, int first, int last) { + for (int row = first; row <= last; row++) { + auto idx = sourceModel()->index(row, 0, parent); + sourceModel()->fetchMore(idx); + } + }); + } }); } -- cgit v1.2.3