-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Describe the bug
Lazygit crashed with "invalid memory address or nil pointer dereference error" after deleting a branch and applying filtering.
It seems this was previously fixed in #3058, but it appeared again (I tested on commit 36918560, and it worked fine there).
To Reproduce
Steps to reproduce the behavior:
- Create a branch named "dummy"
- Focus branch list view
- Press
/ - Type: dummy
- Press
Enter,d,Enter
Expected behavior
I expected lazygit to continue and either redo the filter operation, or show all branches.
Screenshots
If applicable, add screenshots to help explain your problem.
Version info:
lazygit: commit=v0.45.0, build date=2025-01-11T10:02:55Z, build source=binaryRelease, version=0.45.0, os=linux, arch=amd64, git version=2.48.1
git version 2.48.1
Additional context
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x583685225cd2]
goroutine 325 [running]:
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshBranches.func3(0x5836851883c5?)
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:495 +0x12
github.com/samber/lo.FindIndexOf[...]({0xc001a920c0?, 0x1, 0xc001a90000}, 0xc001613e50?)
github.com/samber/lo@v1.31.0/find.go:54 +0x57
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshBranches(0xc00074a680, 0x0, 0x0, 0x1)
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:494 +0x707
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshReflogAndBranches(0xc00074a680, 0x0, 0x0)
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:273 +0x74
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.2()
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:130 +0x1f
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.1({0x0?, 0x0?})
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:107 +0x13
github.com/jesseduffield/gocui.(*Gui).onWorkerAux(0xc0003661c0, 0x0?, {0x5836856e1638?, 0xc00007b260?})
github.com/jesseduffield/gocui@v0.3.1-0.20250107151125-716b1eb82fb4/gui.go:701 +0x65
github.com/jesseduffield/gocui.(*Gui).OnWorker.func1()
github.com/jesseduffield/gocui@v0.3.1-0.20250107151125-716b1eb82fb4/gui.go:688 +0x2b
created by github.com/jesseduffield/gocui.(*Gui).OnWorker in goroutine 225
github.com/jesseduffield/gocui@v0.3.1-0.20250107151125-716b1eb82fb4/gui.go:687 +0x92
Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.
I tried compiling from master. The issue persists