Skip to content

Commit

Permalink
Fix crash when checking the sync file status (#11982)
Browse files Browse the repository at this point in the history
Sometimes a `Folder` is created for a local path that we cannot sync
(e.g. it's not writable). This folder will not have a sync engine. If
the engine of this `Folder` is accessed, this will lead to a crash.

The fix is to check for the existance of a sync engine in the
`Folder::canSync()` method.

Fixes: #11981
  • Loading branch information
erikjv authored and DeepDiver1975 committed Nov 29, 2024
1 parent 8f442ac commit ae34439
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ bool Folder::syncPaused() const

bool Folder::canSync() const
{
return !syncPaused() && accountState()->readyForSync() && isReady() && _accountState->account()->hasCapabilities() && _folderWatcher;
return _engine && !syncPaused() && accountState()->readyForSync() && isReady() && _accountState->account()->hasCapabilities() && _folderWatcher;
}

bool Folder::isReady() const
Expand Down

0 comments on commit ae34439

Please sign in to comment.