fix: Height can not be negative (#869)

This commit is contained in:
leo 2025-01-07 09:48:44 +08:00
parent 7f9be03e5c
commit 8b04ab52d6
No known key found for this signature in database

View file

@ -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;