From f04b0c5d97f50fc99761d67dbe73aa0bbb4d684d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20W?= Date: Tue, 3 Jun 2025 22:20:04 +0200 Subject: [PATCH] fix: prevent exception on repo with no commits/branches Signed-off-by: leo --- src/ViewModels/Repository.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index e20669e1..2b2771ec 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -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); }); }