Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash while pressing up in metadata on empty dir #485

Open
TypicalAM opened this issue Nov 24, 2024 · 5 comments
Open

Crash while pressing up in metadata on empty dir #485

TypicalAM opened this issue Nov 24, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@TypicalAM
Copy link

superfile panics when pressing the up keybind while being in the metadata section. Steps to reproduce

  • go install github.com/yorukot/superfile@latest
  • cd $(mktemp -d)
  • superfile # Press m and up
Caught panic:

runtime error: index out of range [-1]

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
        /usr/lib/golang/src/runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
        /usr/lib/golang/src/runtime/debug/stack.go:16 +0x13
github.com/charmbracelet/bubbletea.(*Program).recoverFromPanic(0xc0001b4000)
        /home/adam/.go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:705 +0x91
panic({0xd8ae60?, 0xc000710e40?})
        /usr/lib/golang/src/runtime/panic.go:770 +0x132
github.com/yorukot/superfile/src/internal.model.metadataRender({{{0xc0001ac008, 0x1, 0x1}, 0x2e, 0x0, 0x2, {0x1, 0x2b}}, {{0xc0001b9600, 0xb, ...}, ...}, ...})
        /home/adam/.go/pkg/mod/github.com/yorukot/[email protected]/src/internal/model_render.go:319 +0x905
github.com/yorukot/superfile/src/internal.model.View({{{0xc0001ac008, 0x1, 0x1}, 0x2e, 0x0, 0x2, {0x1, 0x2b}}, {{0xc0001b9600, 0xb, ...}, ...}, ...})
        /home/adam/.go/pkg/mod/github.com/yorukot/[email protected]/src/internal/model.go:283 +0x1f8
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc0001b4000, {0x11d9198?, 0xc0001aea88?}, 0xc000118540)
        /home/adam/.go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:463 +0x858
github.com/charmbracelet/bubbletea.(*Program).Run(0xc0001b4000)
        /home/adam/.go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:595 +0xaad
github.com/yorukot/superfile/src/cmd.Run.func2(0xc0003c7b80)
        /home/adam/.go/pkg/mod/github.com/yorukot/[email protected]/src/cmd/main.go:79 +0x199
github.com/urfave/cli/v2.(*Command).Run(0xc0001ea580, 0xc0003c7b80, {0xc000110060, 0x1, 0x1})
        /home/adam/.go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:276 +0x97d
github.com/urfave/cli/v2.(*App).RunContext(0xc0001b8200, {0x11d9d50, 0x18339c0}, {0xc000110060, 0x1, 0x1})
        /home/adam/.go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:333 +0x5a5
github.com/urfave/cli/v2.(*App).Run(...)
        /home/adam/.go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:307
github.com/yorukot/superfile/src/cmd.Run({0xc0000061c0?})
        /home/adam/.go/pkg/mod/github.com/yorukot/[email protected]/src/cmd/main.go:89 +0x36a
main.main()
        /home/adam/.go/pkg/mod/github.com/yorukot/[email protected]/main.go:15 +0x1a
@TypicalAM TypicalAM added the bug Something isn't working label Nov 24, 2024
@yorukot
Copy link
Owner

yorukot commented Nov 25, 2024

What does the metadata panel show before press up?

@TypicalAM
Copy link
Author

Nothing:

image

@yorukot
Copy link
Owner

yorukot commented Nov 27, 2024

I'm going to try to fix this, but I don't have a file without metadata. It's a bit difficult to test.

If you don't mind, could you send me the file or tell me how to get it?

@TypicalAM
Copy link
Author

Here it is in docker, can't really tell anything more:

  • docker run --rm -it golang:1.23-bookworm
  • go install github.com/yorukot/superfile@latest
  • cd $(mktemp -d) # Creates a temporary empty dir and enters it
  • superfile # m and up

@yorukot
Copy link
Owner

yorukot commented Nov 28, 2024

Ok thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants