Skip to content

Random crash on start #4940

@gmlexx

Description

@gmlexx

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/[email protected]/gui.go:721 +0x68
github.com/jesseduffield/gocui.(*Gui).OnWorker.func1()
        github.com/jesseduffield/[email protected]/gui.go:708 +0x30
created by github.com/jesseduffield/gocui.(*Gui).OnWorker in goroutine 1
        github.com/jesseduffield/[email protected]/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions