mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 17:37:36 +03:00
FolderStatusModel: fix assert in Qt when the list of subfolder is empty
Fix an assert that happens in beginInsertRows when opening a folder and that folder is empty. This can only be reproduced with a debug build of Qt.
This commit is contained in:
parent
e2e56f45af
commit
c17a678385
1 changed files with 7 additions and 3 deletions
|
@ -614,6 +614,8 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
|
|||
if (!parentInfo) {
|
||||
return;
|
||||
}
|
||||
ASSERT(parentInfo->_fetching); // we should only get a result if we were doing a fetch
|
||||
ASSERT(parentInfo->_subs.isEmpty());
|
||||
|
||||
if (parentInfo->hasLabel()) {
|
||||
beginRemoveRows(idx, 0, 0);
|
||||
|
@ -712,9 +714,11 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
|
|||
newSubs.append(newInfo);
|
||||
}
|
||||
|
||||
beginInsertRows(idx, 0, newSubs.size() - 1);
|
||||
parentInfo->_subs = std::move(newSubs);
|
||||
endInsertRows();
|
||||
if (!newSubs.isEmpty()) {
|
||||
beginInsertRows(idx, 0, newSubs.size() - 1);
|
||||
parentInfo->_subs = std::move(newSubs);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
for (auto it = undecidedIndexes.begin(); it != undecidedIndexes.end(); ++it) {
|
||||
suggestExpand(idx.child(*it, 0));
|
||||
|
|
Loading…
Reference in a new issue