4.4.1 - panic on startup
herbygillot opened this issue · comments
Describe the bug
Starting Ticker v4.4.1 for the first time seems to cause a panic?
panic: runtime error: index out of range [0] with length 0
goroutine 26 [running]:
github.com/achannarasappa/ticker/internal/ui.generateQuoteMsg.func1()
/opt/macports-test/var/macports/build/_Users_herby_Source_macports-ports_finance_ticker/ticker/work/gopath/src/github.com/achannarasappa/ticker/internal/ui/ui.go:55 +0x140
github.com/charmbracelet/bubbletea.(*Program).StartReturningModel.func7.1(0x140001fe400, 0x140001a82e8, {0x104d43918, 0x140001de840})
/opt/macports-test/var/macports/build/_Users_herby_Source_macports-ports_finance_ticker/ticker/work/gopath/pkg/mod/github.com/charmbracelet/bubbletea@v0.19.2/tea.go:472 +0x34
created by github.com/charmbracelet/bubbletea.(*Program).StartReturningModel.func7
/opt/macports-test/var/macports/build/_Users_herby_Source_macports-ports_finance_ticker/ticker/work/gopath/pkg/mod/github.com/charmbracelet/bubbletea@v0.19.2/tea.go:470 +0xe8
To Reproduce
Steps to reproduce the behavior:
- Build ticker 4.4.1 in a fresh environment, no pre-existing config or anything
- Run it.
- See panic.
Expected behavior
That runs and doesn't panic, or runs and exits cleanly (even with an error exit code if necessary).
Environment (please complete the following information):
- OS: macOS 12.1
- Terminal: iTerm
- Terminal Version: 3.4.14
- ticker Version: v4.4.1
Additional context
When run in the exact same environment and same way, v4.3.0 starts without issue.
Thanks for reporting this - this should be fixed in v4.4.3 but let me know if you're still seeing the issue
4.4.3 looks better, but when run with the print
sub-command, we're still seeing panic:
$ .../ticker print
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/achannarasappa/ticker/internal/print.Run.func1(0x1008d0d40, {0x10090b138, 0x0, 0x0})
/opt/macports-test/var/macports/build/_Users_herby_Source_macports-ports_finance_ticker/ticker/work/gopath/src/github.com/achannarasappa/ticker/internal/print/print.go:87 +0x268
github.com/spf13/cobra.(*Command).execute(0x1008d0d40, {0x10090b138, 0x0, 0x0})
/opt/macports-test/var/macports/build/_Users_herby_Source_macports-ports_finance_ticker/ticker/work/gopath/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:854 +0x640
github.com/spf13/cobra.(*Command).ExecuteC(0x1008d0aa0)
/opt/macports-test/var/macports/build/_Users_herby_Source_macports-ports_finance_ticker/ticker/work/gopath/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:958 +0x404
github.com/spf13/cobra.(*Command).Execute(...)
/opt/macports-test/var/macports/build/_Users_herby_Source_macports-ports_finance_ticker/ticker/work/gopath/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:895
github.com/achannarasappa/ticker/cmd.Execute()
/opt/macports-test/var/macports/build/_Users_herby_Source_macports-ports_finance_ticker/ticker/work/gopath/src/github.com/achannarasappa/ticker/cmd/root.go:42 +0x30
main.main()
/opt/macports-test/var/macports/build/_Users_herby_Source_macports-ports_finance_ticker/ticker/work/gopath/src/github.com/achannarasappa/ticker/main.go:6 +0x20
Thanks for finding that issue - I've added the missing validation in v4.4.4
OK thanks, confirmed that v4.4.4 is working. The MacPorts port for ticker
has been updated. Closing this issue.