diff options
Diffstat (limited to 'pkg/gui/filetree/file_tree.go')
-rw-r--r-- | pkg/gui/filetree/file_tree.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/gui/filetree/file_tree.go b/pkg/gui/filetree/file_tree.go index 9d3bb580d..b80499cfd 100644 --- a/pkg/gui/filetree/file_tree.go +++ b/pkg/gui/filetree/file_tree.go @@ -5,6 +5,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/types" + "github.com/jesseduffield/lazygit/pkg/utils" "github.com/samber/lo" "github.com/sirupsen/logrus" ) @@ -138,7 +139,8 @@ func (self *FileTree) GetAllItems() []*FileNode { } func (self *FileTree) Len() int { - return self.tree.Size(self.collapsedPaths) - 1 // ignoring root + // -1 because we're ignoring the root + return utils.Max(self.tree.Size(self.collapsedPaths)-1, 0) } func (self *FileTree) GetItem(index int) types.HasUrn { |