diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-02 10:51:17 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-02 11:09:12 +1100 |
commit | 44896bcd5143797c0673f3fdcf7f464e0ffb4736 (patch) | |
tree | 9be762773c32a274c8a91e644b287194ab8f0fa2 /pkg/gui/filetree | |
parent | bdf2b2d5c4bfd2da246a3e83bc436004a2aa119d (diff) |
safer code
Diffstat (limited to 'pkg/gui/filetree')
-rw-r--r-- | pkg/gui/filetree/commit_file_node.go | 4 | ||||
-rw-r--r-- | pkg/gui/filetree/file_node.go | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/pkg/gui/filetree/commit_file_node.go b/pkg/gui/filetree/commit_file_node.go index 1f1be2a3f..b6fd5ea55 100644 --- a/pkg/gui/filetree/commit_file_node.go +++ b/pkg/gui/filetree/commit_file_node.go @@ -115,6 +115,10 @@ func (node *CommitFileNode) GetIndexForPath(path string, collapsedPaths map[stri } func (node *CommitFileNode) Size(collapsedPaths map[string]bool) int { + if node == nil { + return 0 + } + return size(node, collapsedPaths) } diff --git a/pkg/gui/filetree/file_node.go b/pkg/gui/filetree/file_node.go index cf3e69aa8..dfda68f29 100644 --- a/pkg/gui/filetree/file_node.go +++ b/pkg/gui/filetree/file_node.go @@ -101,6 +101,10 @@ func (node *FileNode) GetIndexForPath(path string, collapsedPaths map[string]boo } func (node *FileNode) Size(collapsedPaths map[string]bool) int { + if node == nil { + return 0 + } + return size(node, collapsedPaths) } |