From 8b04ab52d6b65c02422a4ba50ee69740cf43cc0b Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 7 Jan 2025 09:48:44 +0800 Subject: [PATCH] fix: `Height` can not be negative (#869) --- src/Views/Repository.axaml.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Views/Repository.axaml.cs b/src/Views/Repository.axaml.cs index e12d1c15..def82f89 100644 --- a/src/Views/Repository.axaml.cs +++ b/src/Views/Repository.axaml.cs @@ -248,6 +248,9 @@ namespace SourceGit.Views return; var leftHeight = LeftSidebarGroups.Bounds.Height - 28.0 * 5 - 4; + if (leftHeight <= 0) + return; + var localBranchRows = vm.IsLocalBranchGroupExpanded ? LocalBranchTree.Rows.Count : 0; var remoteBranchRows = vm.IsRemoteGroupExpanded ? RemoteBranchTree.Rows.Count : 0; var desiredBranches = (localBranchRows + remoteBranchRows) * 24.0; @@ -307,7 +310,7 @@ namespace SourceGit.Views WorktreeList.Height = height; } - if (desiredBranches > leftHeight) + if (leftHeight > 0 && desiredBranches > leftHeight) { var local = localBranchRows * 24.0; var remote = remoteBranchRows * 24.0;