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 Nov 18, 2024
1 parent 02ebb07 commit b65361a
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 @@ -408,7 +408,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 b65361a

Please sign in to comment.