Skip to content

Commit

Permalink
fix: crash when checking the sync file status (#11982) (#12000)
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

Co-authored-by: Erik Verbruggen <[email protected]>
  • Loading branch information
DeepDiver1975 and erikjv authored Nov 29, 2024
1 parent 8f442ac commit e04263d
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 e04263d

Please sign in to comment.