Raghav-rv28/kitty-sesh

Crashes when no kitty sessions exist.

Opened this issue · 0 comments

When no saved kitty sessions exist, entering the kitty session TUI and pressing 'r' to rename or 'd' to delete a session crashes the program. Here is the output from pressing 'r': panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/rivo/tview.(*Application).Run.func1()
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/application.go:285 +0x45
panic({0x5a2aa0?, 0xc000392000?})
/usr/lib/go/src/runtime/panic.go:770 +0x132
github.com/rivo/tview.(*List).GetItemText(...)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/list.go:406
main.main.func2(0xc0000ac0c0)
/tmp/tmp.PXT6dc22PY/main.go:118 +0x9eb
github.com/rivo/tview.(*List).InputHandler.(*Box).WrapInputHandler.func2(0xc0000b43c0?, 0xc0000a6180)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/box.go:164 +0x37
github.com/rivo/tview.(*Frame).InputHandler.func1(0xc0000ac0c0, 0xc0000a6180)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/frame.go:218 +0x46
github.com/rivo/tview.(*Frame).InputHandler.(*Box).WrapInputHandler.func2(0xc0000a27e0?, 0xc000400008?)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/box.go:167 +0x50
github.com/rivo/tview.(*Flex).InputHandler.func1(0xc0000ac0c0, 0xc0000a6180)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/flex.go:255 +0xd7
github.com/rivo/tview.(*Flex).InputHandler.(*Box).WrapInputHandler.func2(0xc00009c120?, 0xc00015fb70?)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/box.go:167 +0x50
github.com/rivo/tview.(*Application).Run(0xc0000c6000)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/application.go:404 +0x9a2
main.main()
/tmp/tmp.PXT6dc22PY/main.go:217 +0x1025

And here is the output of pressing 'd' and then confirming yes to delete the session (Doing 'D' to delete all sessions does not crash):
panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/rivo/tview.(*Application).Run.func1()
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/application.go:285 +0x45
panic({0x5a2aa0?, 0xc0003a4000?})
/usr/lib/go/src/runtime/panic.go:770 +0x132
github.com/rivo/tview.(*List).GetItemText(...)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/list.go:406
main.main.func2.1(0xc00045a000?, {0x5b6951?, 0x4b03c0?})
/tmp/tmp.PXT6dc22PY/main.go:135 +0x495
github.com/rivo/tview.(*Modal).AddButtons.func1.1()
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/modal.go:115 +0x2f
github.com/rivo/tview.(*Form).InputHandler.func1.(*Button).InputHandler.1(0xc00015f988?, 0x416145?)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/button.go:173 +0x4d
github.com/rivo/tview.(*Form).InputHandler.func1.(*Button).InputHandler.(*Box).WrapInputHandler.2(0x18?, 0xc0000a6db0?)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/box.go:167 +0x50
github.com/rivo/tview.(*Form).InputHandler.func1(0xc0000ac7c0, 0xc0000a6db0)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/form.go:863 +0x150
github.com/rivo/tview.(*Form).InputHandler.(*Box).WrapInputHandler.func2(0xc0000b4500?, 0x10?)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/box.go:167 +0x50
github.com/rivo/tview.(*Modal).InputHandler.func1.(*Frame).InputHandler.1(0xc0000ac7c0, 0xc0000a6db0)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/frame.go:218 +0x46
github.com/rivo/tview.(*Modal).InputHandler.func1.(*Frame).InputHandler.(*Box).WrapInputHandler.2(0xc0000b4500?, 0xc000397de8?)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/box.go:167 +0x50
github.com/rivo/tview.(*Modal).InputHandler.func1(0xc0000ac7c0?, 0xc0000a6db0?)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/modal.go:209 +0xb9
github.com/rivo/tview.(*Modal).InputHandler.(*Box).WrapInputHandler.func2(0xc0000ae0c0?, 0xc000088008?)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/box.go:167 +0x50
github.com/rivo/tview.(*Flex).InputHandler.func1(0xc0000ac7c0, 0xc0000a6db0)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/flex.go:255 +0xd7
github.com/rivo/tview.(*Flex).InputHandler.(*Box).WrapInputHandler.func2(0xc00009c120?, 0xc00015fb70?)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/box.go:167 +0x50
github.com/rivo/tview.(*Application).Run(0xc0000c6000)
/home/stephen/go/pkg/mod/github.com/rivo/tview@v0.0.0-20240413115534-b0d41c484b95/application.go:404 +0x9a2
main.main()
/tmp/tmp.PXT6dc22PY/main.go:217 +0x1025