fix: prevent exception on repo with no commits/branches

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
Göran W 2025-06-03 22:20:04 +02:00 committed by leo
parent 406ace9e79
commit f04b0c5d97
No known key found for this signature in database

View file

@ -1120,7 +1120,8 @@ namespace SourceGit.ViewModels
if (_workingCopy != null)
_workingCopy.HasRemotes = remotes.Count > 0;
GetOwnerPage()?.ChangeDirtyState(Models.DirtyState.HasPendingPullOrPush, !CurrentBranch.TrackStatus.IsVisible);
var hasPendingPullOrPush = CurrentBranch?.TrackStatus.IsVisible ?? false;
GetOwnerPage()?.ChangeDirtyState(Models.DirtyState.HasPendingPullOrPush, !hasPendingPullOrPush);
});
}