Skip to content

Commit

Permalink
fix: prevent panic when create tree for no paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Broderick-Westrope committed Jan 12, 2025
1 parent ba06c60 commit 3615eb9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func IsBinaryFile(path string) (bool, error) {

// GenerateTree creates a textual representation of the directory structure
func GenerateTree(paths []PathInfo) string {
if len(paths) == 0 {
return "< no paths found >\n"
}

mapPathToChildren := make(map[string][]PathInfo)
for _, path := range paths {
if path.Depth == 0 {
Expand Down

0 comments on commit 3615eb9

Please sign in to comment.