From 124abc6149d638d60ee65e300b4cac8df35b5be3 Mon Sep 17 00:00:00 2001 From: SAY-5 Date: Fri, 1 May 2026 22:00:09 -0700 Subject: [PATCH] remote_branches: skip nil entries in GetRemoteBranchListDisplayStrings Closes #5370. Race between remote-list refresh leaves stale nil pointers; use FilterMap. --- pkg/gui/presentation/remote_branches.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 }) }