jesseduffield / jesseduffield/lazygit

Random crash on start

Open
#4,940 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

### Describe the bug

Failed to run once, the second run was successful.

```
panic: runtime error: index out of range [-1]

goroutine 136 [running]:
github.com/jesseduffield/lazygit/pkg/gui/context.(*ListViewModel[...]).GetSelected(0x101332f60)
github.com/jesseduffield/lazygit/pkg/gui/context/list_view_model.go:33 +0x80
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshRemotes(0x1400060ee40)
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:652 +0x44
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.11()
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:167 +0x20
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:106 +0x24
github.com/jesseduffield/gocui.(*Gui).onWorkerAux(0x14000276000, 0x0?, {0x101329880?, 0x14000214ba0?})
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/gui.go:721 +0x68
github.com/jesseduffield/gocui.(*Gui).OnWorker.func1()
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/gui.go:708 +0x30
created by github.com/jesseduffield/gocui.(*Gui).OnWorker in goroutine 1
github.com/jesseduffield/gocui@v0.3.1-0.20250711082438-4aa4fd0b4d22/gui.go:707 +0x88
```
### To Reproduce

No idea

### Expected behavior

No crash, obviously

### Screenshots

Image

### Version info:

* _Run `lazygit --version`
```
commit=, build date=, build source=Homebrew, version=0.55.1, os=darwin, arch=arm64, git version=2.51.0
```
* _Run `git --version`
```
git version 2.51.0
```

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.