lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Nil pointer on *RemoteBranch.FullName

Open glensargent opened this issue 1 year ago • 0 comments

Describe the bug Lazygit panics due to nil pointer dereference. I'm happy to PR a change that makes the relevant function more defensive if need be, but i'm unfamiliar with the src so not sure where else I'd have to check

To Reproduce Unfortunately not able to reproduce since I'm not exactly sure what caused it / what I did before hand.

Expected behavior N/A

Screenshots image

Version info: commit=, build date=, build source=homebrew, version=0.41.0, os=darwin, arch=arm64, git version=2.39.3 (Apple Git-146) git version 2.39.3 (Apple Git-146)

Additional context

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x1049ff3b8]

goroutine 898521 [running]:
github.com/jesseduffield/lazygit/pkg/commands/models.(*RemoteBranch).FullName(0x140008bfec0?)
        github.com/jesseduffield/lazygit/pkg/commands/models/remote_branch.go:10 +0x18
github.com/jesseduffield/lazygit/pkg/gui/context.NewRemoteBranchesContext.func3.GetRemoteBranchListDisplayStrings.1(0x0, 0x140014f7e50?)
        github.com/jesseduffield/lazygit/pkg/gui/presentation/remote_branches.go:12 +0x30
github.com/samber/lo.Map[...]({0x140000bafa0?, 0x2, 0x104b76990}, 0x14001229c80?)
        github.com/samber/[email protected]/slice.go:29 +0x80
github.com/jesseduffield/lazygit/pkg/gui/presentation.GetRemoteBranchListDisplayStrings(...)
        github.com/jesseduffield/lazygit/pkg/gui/presentation/remote_branches.go:11
github.com/jesseduffield/lazygit/pkg/gui/context.NewRemoteBranchesContext.func3(0x10?, 0x1056a1c60?)
        github.com/jesseduffield/lazygit/pkg/gui/context/remote_branches_context.go:32 +0x98
github.com/jesseduffield/lazygit/pkg/gui/context.(*ListRenderer).renderLines(0x140001a9610, 0xffffffffffffffff, 0xffffffffffffffff)
        github.com/jesseduffield/lazygit/pkg/gui/context/list_renderer.go:88 +0x160
github.com/jesseduffield/lazygit/pkg/gui/context.(*ListContextTrait).HandleRender(0x140001a9600)
        github.com/jesseduffield/lazygit/pkg/gui/context/list_context_trait.go:96 +0x44
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).postRefreshUpdate(0x14000294908, {0x10504fd28, 0x1400000e690})
        github.com/jesseduffield/lazygit/pkg/gui/view_helpers.go:139 +0x98
github.com/jesseduffield/lazygit/pkg/gui.(*guiCommon).PostRefreshUpdate(0x1400001e400?, {0x10504fd28?, 0x1400000e690?})
        github.com/jesseduffield/lazygit/pkg/gui/gui_common.go:33 +0x28
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshView(0x14000293280, {0x10504fd28, 0x1400000e690})
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:732 +0x50
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshRemotes(0x14000293280)
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:657 +0x1b0
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.9()
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:163 +0x20
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.1({0x0?, 0x1049fd200?})
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:108 +0x24
github.com/jesseduffield/gocui.(*Gui).onWorkerAux(0x1049fd0f0?, 0x140011b41b0?, {0x105043238?, 0x14000711100?})
        github.com/jesseduffield/[email protected]/gui.go:680 +0x6c
github.com/jesseduffield/gocui.(*Gui).OnWorker.func1()
        github.com/jesseduffield/[email protected]/gui.go:667 +0x34
created by github.com/jesseduffield/gocui.(*Gui).OnWorker in goroutine 898317
        github.com/jesseduffield/[email protected]/gui.go:666 +0x94

glensargent avatar Apr 23 '24 18:04 glensargent