From: Camila Date: Tue, 27 Oct 2020 17:59:05 +0000 (+0100) Subject: Check if there are patterns associated with a sync exclude file. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~42^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bdd3465e7b3368d04358247c779ef2b47bb116c4;p=nextcloud-desktop.git Check if there are patterns associated with a sync exclude file. The previous check didn't take into the account that .sync-exclude.lst might be empty which would crash at Q_ASSERT(_allExcludes.contains(basePath)) in the prepare function. It also takes into account that _allExcludes[basePath] was creating new items in the list. Signed-off-by: Camila --- diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index b34a521cf..61bfdd443 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -317,17 +317,20 @@ bool ExcludedFiles::loadExcludeFile(const QByteArray & basePath, const QString & if (!f.open(QIODevice::ReadOnly)) return false; + QList patterns; while (!f.atEnd()) { QByteArray line = f.readLine().trimmed(); if (line.isEmpty() || line.startsWith('#')) continue; csync_exclude_expand_escapes(line); - _allExcludes[basePath].append(line); + patterns.append(line); } + _allExcludes.insert(basePath, patterns); // nothing to prepare if the user decided to not exclude anything - if(_allExcludes.size()) + if (!_allExcludes.value(basePath).isEmpty()){ prepare(basePath); + } return true; }