diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2022-04-25 16:02:03 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2022-04-26 14:28:33 +0300 |
commit | 8d0dd36d2d1736abcb341561157372c110b71e17 (patch) | |
tree | eb3f852ba5e529173a53eb7fce0041f1f2053143 /src/gui/folder.cpp | |
parent | c5cc5a68558d7e0d4e236cbfc4b7ead9cebdab4b (diff) |
Fix crash
Fixes: #9600
Diffstat (limited to 'src/gui/folder.cpp')
-rw-r--r-- | src/gui/folder.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index e71597016..1d78a6ca1 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -599,6 +599,7 @@ int Folder::slotWipeErrorBlacklist() void Folder::slotWatchedPathChanged(const QString &path, ChangeReason reason) { + Q_ASSERT(isReady()); if (!FileSystem::isChildPathOf(path, this->path())) { qCDebug(lcFolder) << "Changed path is not contained in folder, ignoring:" << path; return; @@ -809,22 +810,25 @@ void Folder::removeFromSettings() const bool Folder::isFileExcludedAbsolute(const QString &fullPath) const { + if (!_engine) { + return true; + } return _engine->excludedFiles().isExcluded(fullPath, path(), _definition.ignoreHiddenFiles); } bool Folder::isFileExcludedRelative(const QString &relativePath) const { - return _engine->excludedFiles().isExcluded(path() + relativePath, path(), _definition.ignoreHiddenFiles); + return isFileExcludedAbsolute(path() + relativePath); } void Folder::slotTerminateSync() { - qCInfo(lcFolder) << "folder " << alias() << " Terminating!"; - - if (_engine->isSyncRunning()) { - _engine->abort(); - - setSyncState(SyncResult::SyncAbortRequested); + if (isReady()) { + qCInfo(lcFolder) << "folder " << alias() << " Terminating!"; + if (_engine->isSyncRunning()) { + _engine->abort(); + setSyncState(SyncResult::SyncAbortRequested); + } } } @@ -875,6 +879,9 @@ void Folder::wipeForRemoval() bool Folder::reloadExcludes() { + if (!_engine) { + return true; + } return _engine->excludedFiles().reloadExcludeFiles(); } @@ -941,6 +948,7 @@ void Folder::startSync() void Folder::setSyncOptions() { + Q_ASSERT(isReady()); SyncOptions opt; ConfigFile cfgFile; @@ -964,6 +972,7 @@ void Folder::setSyncOptions() void Folder::setDirtyNetworkLimits() { + Q_ASSERT(isReady()); ConfigFile cfg; int downloadLimit = -75; // 75% int useDownLimit = cfg.useDownloadLimit(); @@ -999,6 +1008,7 @@ void Folder::slotSyncStarted() void Folder::slotSyncFinished(bool success) { + Q_ASSERT(isReady()); qCInfo(lcFolder) << "Client version" << Theme::instance()->aboutVersions(Theme::VersionFormat::OneLiner); bool syncError = !_syncResult.errorStrings().isEmpty(); |