summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/commands/branch_list_builder.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/commands/branch_list_builder.go b/pkg/commands/branch_list_builder.go
index 553d2f1f9..89b28d030 100644
--- a/pkg/commands/branch_list_builder.go
+++ b/pkg/commands/branch_list_builder.go
@@ -51,8 +51,11 @@ func (b *BranchListBuilder) obtainBranches() []*Branch {
trimmedOutput := strings.TrimSpace(output)
outputLines := strings.Split(trimmedOutput, "\n")
- branches := make([]*Branch, len(outputLines))
- for i, line := range outputLines {
+ if len(outputLines) <= 1 {
+ return []*Branch{}
+ }
+ branches := make([]*Branch, len(outputLines)-1)
+ for i, line := range outputLines[1:] {
split := strings.Split(line, SEPARATION_CHAR)
name := split[0]