browser-gopher icon indicating copy to clipboard operation
browser-gopher copied to clipboard

Search Failed on Ubuntu

Open ddxv opened this issue 3 years ago • 0 comments

Searching any string causes a panic.

steps:

  • install, build, populate
  • ./browser-gopher search
  • Prompt shows for search
  • I can type out words for a search, but nothing happens
  • Pressing enter causes panic

Trying various strings all caused the issue: hi, "hi", longersearch etc

Caught panic:

runtime error: index out of range [0] with length 0

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
	/usr/lib/go-1.18/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
	/usr/lib/go-1.18/src/runtime/debug/stack.go:16 +0x19
github.com/charmbracelet/bubbletea.(*Program).StartReturningModel.func3()
	/home/james/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:370 +0x95
panic({0xbecee0, 0xc0001f8d38})
	/usr/lib/go-1.18/src/runtime/panic.go:844 +0x258
github.com/iansinnott/browser-gopher/cmd.OpenItem({0xd58780?, 0xc0004023c0?})
	/home/james/browser-gopher/cmd/search.go:67 +0x14f
github.com/iansinnott/browser-gopher/cmd.model.Update({{{0x0, 0x0}, {0xc291fb, 0x2}, {0xc2c333, 0x9}, 0x1f972880, 0x0, 0x2a, {0x0, ...}, ...}, ...}, ...)
	/home/james/browser-gopher/cmd/search.go:99 +0x271
github.com/charmbracelet/bubbletea.(*Program).StartReturningModel(0xc0001ca4d0)
	/home/james/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:539 +0x1291
github.com/charmbracelet/bubbletea.(*Program).Start(...)
	/home/james/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:548
github.com/iansinnott/browser-gopher/cmd.glob..func8(0x12b0560, {0x12e8fc0, 0x0, 0x0?})
	/home/james/browser-gopher/cmd/search.go:215 +0x810
github.com/spf13/cobra.(*Command).execute(0x12b0560, {0x12e8fc0, 0x0, 0x0})
	/home/james/go/pkg/mod/github.com/spf13/[email protected]/command.go:876 +0x67b
github.com/spf13/cobra.(*Command).ExecuteC(0x12b0060)
	/home/james/go/pkg/mod/github.com/spf13/[email protected]/command.go:990 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
	/home/james/go/pkg/mod/github.com/spf13/[email protected]/command.go:918
github.com/iansinnott/browser-gopher/cmd.Execute()
	/home/james/browser-gopher/cmd/root.go:50 +0x25
main.main()
	/home/james/browser-gopher/main.go:12 +0x17

ddxv avatar Oct 24 '22 00:10 ddxv