Handle "no processes" case better
savannahostrowski opened this issue · 2 comments
savannahostrowski commented
Right now, I just silence the error when there are no processes running. This is obviously a hack and should be properly handled.
savannahostrowski commented
On top of that if you hit enter in a pane with no processes in the list, you'll run into a runtime error:
Caught panic:
runtime error: invalid memory address or nil pointer dereference
Restoring terminal...
goroutine 1 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x19
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
/home/savannah/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.23.2/tea.go:402 +0x95
panic({0x54ad20, 0x6dd0f0})
/usr/local/go/src/runtime/panic.go:890 +0x263
main.model.Update({{0x0, 0x1, 0x1, 0x1, 0x1, 0x1, {0x56fe98, 0x7}, {0x570627, 0x9}, ...}, ...}, ...)
/home/savannah/go/pkg/mod/github.com/savannahostrowski/gruyere@v1.1.1/main.go:101 +0x596
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc00015e000, {0x5ace48?, 0xc000147b00?}, 0x5703ba?)
/home/savannah/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.23.2/tea.go:343 +0x60a
github.com/charmbracelet/bubbletea.(*Program).Run(0xc00015e000)
/home/savannah/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.23.2/tea.go:465 +0x7fd
main.main()
/home/savannah/go/pkg/mod/github.com/savannahostrowski/gruyere@v1.1.1/main.go:169 +0x278
whoop-t commented
@savannahostrowski Improvements for this issue can be found in this PR