diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-03-15 19:17:33 +0300 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2017-03-15 19:23:39 +0300 |
commit | 8e68e0321c8fabd6e5aafed1020823a29fee30d8 (patch) | |
tree | 6a1cecf17c4eb211943378e53faab22dc1420817 /src/gui/folderstatusmodel.cpp | |
parent | 881b32521b6aab2bdb73353175e7e2f666447747 (diff) |
Attempt to fix a crash in FolderStatusModel::slotUpdateDirectories
The backtrace looks like:
File "atomic_base.h", line 396, in QString::~QString
File "qlist.h", line 442, in OCC::FolderStatusModel::slotUpdateDirectories
This is the only QList operation, and it may crash if the list is empty.
It can be empty if the propfind returned empty results.
I'm not sure how this can be possible to have an empty list there since
the server is always supposed to return at least one entry, for the directory
itself. But it can happen if a directory was transformed in a file, or
if there is a bug on the server.
Diffstat (limited to 'src/gui/folderstatusmodel.cpp')
-rw-r--r-- | src/gui/folderstatusmodel.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 65ff918d5..a4079ff07 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -631,8 +631,8 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list) const auto permissionMap = job->property(propertyPermissionMap).toMap(); QStringList sortedSubfolders = list; - // skip the parent item (first in the list) - sortedSubfolders.erase(sortedSubfolders.begin()); + if (!sortedSubfolders.isEmpty()) + sortedSubfolders.removeFirst(); // skip the parent item (first in the list) Utility::sortFilenames(sortedSubfolders); QVarLengthArray<int, 10> undecidedIndexes; |