@@ -388,11 +388,9 @@ QUrl Folder::webDavUrl() const
388
388
QString Folder::remotePathTrailingSlash () const
389
389
{
390
390
const QString remote = remotePath ();
391
- if (remote == QLatin1Char (' /' )) {
392
- return remote;
393
- }
394
- Q_ASSERT (!remote.endsWith (QLatin1Char (' /' )));
395
- return remote + QLatin1Char (' /' );
391
+ if (!remote.endsWith ((QLatin1Char (' /' ))))
392
+ return remote + QLatin1Char (' /' );
393
+ return remote;
396
394
}
397
395
398
396
QUrl Folder::remoteUrl () const
@@ -640,7 +638,8 @@ void Folder::slotWatchedPathsChanged(const QSet<QString> &paths, ChangeReason re
640
638
bool needSync = false ;
641
639
for (const auto &path : paths) {
642
640
Q_ASSERT (FileSystem::isChildPathOf (path, this ->path ()));
643
-
641
+ if (!FileSystem::isChildPathOf (path, this ->path ()))
642
+ continue ;
644
643
const QString relativePath = path.mid (this ->path ().size ());
645
644
if (reason == ChangeReason::UnLock) {
646
645
journalDb ()->wipeErrorBlacklistEntry (relativePath, SyncJournalErrorBlacklistRecord::Category::LocalSoftError);
@@ -924,6 +923,9 @@ void Folder::startSync()
924
923
Q_ASSERT (isReady ());
925
924
Q_ASSERT (_folderWatcher);
926
925
926
+ if (!isReady () || !_folderWatcher)
927
+ return ;
928
+
927
929
if (!OC_ENSURE (!isSyncRunning ())) {
928
930
qCCritical (lcFolder) << " ERROR sync is still running and new sync requested." ;
929
931
return ;
@@ -984,6 +986,9 @@ void Folder::startSync()
984
986
void Folder::setDirtyNetworkLimits ()
985
987
{
986
988
Q_ASSERT (isReady ());
989
+ if (!isReady ())
990
+ return ;
991
+
987
992
ConfigFile cfg;
988
993
int downloadLimit = -75 ; // 75%
989
994
int useDownLimit = cfg.useDownloadLimit ();
@@ -1332,7 +1337,6 @@ bool Folder::groupInSidebar() const
1332
1337
if (_accountState->account ()->hasDefaultSyncRoot ()) {
1333
1338
// QFileInfo is horrible and "/foo/" is treated different to "/foo"
1334
1339
const QString parentDir = QFileInfo (Utility::stripTrailingSlash (path ())).dir ().path ();
1335
- Q_ASSERT (QFileInfo (parentDir) != QFileInfo (path ()));
1336
1340
// If parentDir == home, we would add a the home dir to the side bar.
1337
1341
return QFileInfo (parentDir) != QFileInfo (QDir::homePath ()) && FileSystem::isChildPathOf (parentDir, _accountState->account ()->defaultSyncRoot ());
1338
1342
}
@@ -1365,6 +1369,8 @@ QString FolderDefinition::spaceId() const
1365
1369
// we might call the function to check for the id
1366
1370
// anyhow one of the conditions needs to be true
1367
1371
Q_ASSERT (_webDavUrl.isValid () || !_spaceId.isEmpty ());
1372
+ if (!_webDavUrl.isValid () || _spaceId.isEmpty ())
1373
+ return QString ();
1368
1374
return _spaceId;
1369
1375
}
1370
1376
} // namespace OCC
0 commit comments