Skip to content

Commit f04b0c5

Browse files
goran-wlove-linger
authored andcommitted
fix: prevent exception on repo with no commits/branches
Signed-off-by: leo <[email protected]>
1 parent 406ace9 commit f04b0c5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ViewModels/Repository.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,8 @@ public void RefreshBranches()
11201120
if (_workingCopy != null)
11211121
_workingCopy.HasRemotes = remotes.Count > 0;
11221122

1123-
GetOwnerPage()?.ChangeDirtyState(Models.DirtyState.HasPendingPullOrPush, !CurrentBranch.TrackStatus.IsVisible);
1123+
var hasPendingPullOrPush = CurrentBranch?.TrackStatus.IsVisible ?? false;
1124+
GetOwnerPage()?.ChangeDirtyState(Models.DirtyState.HasPendingPullOrPush, !hasPendingPullOrPush);
11241125
});
11251126
}
11261127

0 commit comments

Comments
 (0)