jesseduffield / jesseduffield/lazygit

Nil pointer panic in GetRemoteBranchListDisplayStrings

Open
#5,370 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

Hi,

I've been looking at the crash reported in #5240 and traced it to `pkg/gui/presentation/remote_branches.go`. The `GetRemoteBranchListDisplayStrings` function doesn't guard against nil elements in the `branches` slice before calling `branch.FullName()`.

This can happen during a race between remote editing/refreshing — when the remote list is updated concurrently, stale branch pointers can end up as nil in the slice.

A simple nil check before accessing the branch would prevent the panic.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.