fix: crash after remove worktree while it is opened in sourcegit (#1436)
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-06-19 17:57:49 +08:00
parent 8d74586970
commit 957c52aac4
No known key found for this signature in database

View file

@ -172,7 +172,7 @@ namespace SourceGit.ViewModels
private set
{
var oldHead = _currentBranch?.Head;
if (SetProperty(ref _currentBranch, value))
if (SetProperty(ref _currentBranch, value) && value != null)
{
if (oldHead != _currentBranch.Head && _workingCopy is { UseAmend: true })
_workingCopy.UseAmend = false;