Skip to content

Crash when deleting a repo-folder on disk, if SourceGit has it open in a tab (same when removing a Worktree) #1436

@goran-w

Description

@goran-w

When deleting a repo-folder on disk, while SourceGit has that folder open in a tab/page, we'll get a crash in Repository.RefreshBranches(), on this line: CurrentBranch = branches.Find(x => x.IsCurrent);

Repository.CurrentBranch.set doesn't check (after calling SetProperty()) if the NEW value of _currentBranch is null, before trying to access its Head property. Could be fixed by using _currentBranch?.Head, but we should check that there are no follow-up errors due to there being no branches (and no repo) anymore.

NOTE: I found this crash when I removed a Worktree (from within SourceGit UI) while that Worktree was still open in another tab.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions