Skip to content

panic index out of range #289

@Bajahaw

Description

@Bajahaw

Describe the bug
A clear and concise description of what the bug is.

panic index out of range

panic of array out
To Reproduce
Steps to reproduce the behavior:

open a sqlite db
focused on query section
press backspace
focused on tables section
press escape
tables disappear
press enter
panic

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

OS (please complete the following information):

  • Windows 11
  • app version (0.34.2)

Additional context
trace:

PS C:\Users\radhi> dblab --db 'mysqlite.db' --driver sqlite
panic: runtime error: index out of range [0] with length 0 [recovered, repanicked]

goroutine 1 [running]:
github.com/rivo/tview.(*Application).Run.func1()
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/application.go:297 +0x45
panic({0x7ff7ebe73460?, 0xc00010a930?})
        /opt/hostedtoolcache/go/1.25.2/x64/src/runtime/panic.go:783 +0x132
github.com/rivo/tview.(*List).GetItemText(...)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/list.go:442
github.com/danvergara/dblab/pkg/tui.(*Tui).updateTableMetadataOnChange(0xc0002a8460, {0x0, 0x0})
        /home/runner/work/dblab/dblab/pkg/tui/tui.go:439 +0xba5
github.com/danvergara/dblab/pkg/tui.(*Tui).setupDatabaseCatalog.func4(0xc000158e20)
        /home/runner/work/dblab/dblab/pkg/tui/tui.go:410 +0x45
github.com/rivo/tview.(*List).InputHandler.(*Box).WrapInputHandler.func2(0xc0002d8480?, 0xc00011a330)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/box.go:164 +0x37
github.com/rivo/tview.(*Pages).InputHandler.func1(0xc000158e20, 0xc00011a330)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/pages.go:323 +0xa2
github.com/rivo/tview.(*Pages).InputHandler.(*Box).WrapInputHandler.func2(0xc0002a6900?, 0x7ff7eb48ad45?)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x50
github.com/rivo/tview.(*Flex).InputHandler.func1(0xc000158e20, 0xc00011a330)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/flex.go:255 +0xcf
github.com/rivo/tview.(*Flex).InputHandler.(*Box).WrapInputHandler.func2(0xc000116270?, 0x7ff7eb48ad45?)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x50
github.com/rivo/tview.(*Flex).InputHandler.func1(0xc000158e20, 0xc00011a330)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/flex.go:255 +0xcf
github.com/rivo/tview.(*Flex).InputHandler.(*Box).WrapInputHandler.func2(0xc000116390?, 0x7ff7eb4e5865?)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x50
github.com/rivo/tview.(*Flex).InputHandler.func1(0xc000158e20, 0xc00011a330)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/flex.go:255 +0xcf
github.com/rivo/tview.(*Flex).InputHandler.(*Box).WrapInputHandler.func2(0xc0001165d0?, 0xc0001c3518?)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x50
github.com/rivo/tview.(*Application).Run(0xc0002d6000)
        /home/runner/go/pkg/mod/github.com/rivo/[email protected]/application.go:416 +0x8ba
github.com/danvergara/dblab/pkg/tui.(*Tui).Run(...)
        /home/runner/work/dblab/dblab/pkg/tui/tui.go:593
github.com/danvergara/dblab/pkg/app.(*App).Run(0xc00000a118?)
        /home/runner/work/dblab/dblab/pkg/app/app.go:67 +0x4f
github.com/danvergara/dblab/cmd.init.NewRootCmd.func1(0xc000218200?, {0x7ff7ebec1cc4?, 0x7?, 0x7ff7ebebfe03?})
        /home/runner/work/dblab/dblab/cmd/root.go:145 +0x625
github.com/spf13/cobra.(*Command).execute(0x7ff7ed38ca80, {0xc000052090, 0x4, 0x7})
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1015 +0xb02
github.com/spf13/cobra.(*Command).ExecuteC(0x7ff7ed38ca80)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1148 +0x465
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1071
github.com/danvergara/dblab/cmd.Execute()
        /home/runner/work/dblab/dblab/cmd/root.go:160 +0x1a
main.main()
        /home/runner/work/dblab/dblab/main.go:39 +0x118

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions