yorukot / superfile

Pretty fancy and modern terminal file manager

Home Page:https://superfile.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panic: runtime error: index out of range [-1]

shishkin opened this issue · comments

Describe the bug
I was cycling up/down in help/hotkey popup and superfile crashed.

To Reproduce
Steps to reproduce the behavior:

  1. Press ?
  2. Press up arrow

Expected behavior
It should not crash.

Screenshots

Caught panic:

runtime error: index out of range [-1]

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x64
runtime/debug.PrintStack()
	runtime/debug/stack.go:16 +0x1c
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
	github.com/charmbracelet/bubbletea/tea.go:479 +0x88
panic({0x100d25c60?, 0x1400041c078?})
	runtime/panic.go:770 +0x124
github.com/MHNightCat/superfile/internal.helpMenuRender({{{0x14000168d88, 0x1, 0x1}, 0x7e, 0x0, 0x5}, {{0x14000384e00, 0x8, 0xe}, 0x0}, ...})
	github.com/MHNightCat/superfile/internal/model_render.go:397 +0xa58
github.com/MHNightCat/superfile/internal.model.View({{{0x14000168d88, 0x1, 0x1}, 0x7e, 0x0, 0x5}, {{0x14000384e00, 0x8, 0xe}, 0x0}, ...})
	github.com/MHNightCat/superfile/internal/model.go:194 +0x40c
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0x14000295e10, {0x100d60190?, 0x140001d3008?}, 0x14000110180)
	github.com/charmbracelet/bubbletea/tea.go:414 +0x56c
github.com/charmbracelet/bubbletea.(*Program).Run(0x14000295e10)
	github.com/charmbracelet/bubbletea/tea.go:547 +0x6e4
main.main.func3(0x1400015eb80?)
	github.com/MHNightCat/superfile/main.go:101 +0x11c
github.com/urfave/cli/v2.(*Command).Run(0x14000194420, 0x1400015eb80, {0x1400011e120, 0x1, 0x1})
	github.com/urfave/cli/v2/command.go:276 +0x71c
github.com/urfave/cli/v2.(*App).RunContext(0x140001f2200, {0x100d60890, 0x1011699e0}, {0x1400011e120, 0x1, 0x1})
	github.com/urfave/cli/v2/app.go:333 +0x514
github.com/urfave/cli/v2.(*App).Run(...)
	github.com/urfave/cli/v2/app.go:307
main.main()
	github.com/MHNightCat/superfile/main.go:110 +0x26c

System information (please complete the following information):

  • OS: MacOS
  • Version 14.4.1
  • Superfile Version v1.1.3 (installed via nix with nix shell github:MHNightCat/superfile#superfile)

Got it! Thanks for your report!
Actually v1.1.3 is still under development so there may be some issues :(

Fixed it in bbb3b15