diff --git a/pkg/gui/presentation/remote_branches.go b/pkg/gui/presentation/remote_branches.go index 55e4bc1137e..76980217cc2 100644 --- a/pkg/gui/presentation/remote_branches.go +++ b/pkg/gui/presentation/remote_branches.go @@ -8,9 +8,12 @@ import ( ) func GetRemoteBranchListDisplayStrings(branches []*models.RemoteBranch, diffName string) [][]string { - return lo.Map(branches, func(branch *models.RemoteBranch, _ int) []string { + return lo.FilterMap(branches, func(branch *models.RemoteBranch, _ int) ([]string, bool) { + if branch == nil { + return nil, false + } diffed := branch.FullName() == diffName - return getRemoteBranchDisplayStrings(branch, diffed) + return getRemoteBranchDisplayStrings(branch, diffed), true }) }