panic: runtime error: index out of range
Closed this issue ยท 3 comments
dharrigan commented
Hi,
Interesting project, got a panic:
% vsh
http://vault:8200 /> cd
panic: runtime error: index out of range
goroutine 1 [running]:
main.executor(0xc00001e216, 0x3)
/home/fishi/Workspaces/fishi0x01/vsh/main.go:65 +0x6c5
github.com/c-bata/go-prompt.(*Prompt).Run(0xc0001ac400)
/home/fishi/Workspaces/fishi0x01/vsh/vendor/github.com/c-bata/go-prompt/prompt.go:85 +0x7f2
main.main()
/home/fishi/Workspaces/fishi0x01/vsh/main.go:144 +0x51a
I did this by simply running up vsh, selecting cd and pressing return without choosing the suggestion.
In fact, it seems to happen with all suggestions, without choosing the suggestion, i.e., cp, rm etc...
fishi0x01 commented
Yes you are absolutely right. Some sanity checks are still missing. Will add them later today ๐
fishi0x01 commented
Merged a fix with some basic sanity checking which should prevent panics like above.
However, more sanity checks / better error handling will be added in the (near) future.
dharrigan commented
Fantastic. Will test.
Yup, much better - no crashing ๐ Thanks for fixing!