charmbracelet / charmbracelet/bubbletea

Filtering panic

Open
#826 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
44.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Hey guys, how are you? hope you're doing good :)

We are using your model to display an application to handle **tests jobs**, which are listed in the dash view in the following way:

When i type `/` to enter a filter value and then fill it with some text:

I got the following error:
```bash
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x5e4508]

goroutine 861 [running]:
github.com/charmbracelet/bubbles/list.filterItems.func1()
/home/guido/go/pkg/mod/github.com/charmbracelet/bubbles@v0.16.1/list/list.go:1211 +0x1a8
github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1.1()
/home/guido/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.24.2/tea.go:268 +0x38
created by github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1
/home/guido/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.24.2/tea.go:267 +0x14d
```

Checking the stacktrace seems to be an error at the moment of playing with the list.

I would like to know if there are some examples of how to filter **structs**.

for example:
```go
type oneStruct struct{
string name
int64 id
}
```
(filtering by their name)

And I think this could be the cause of the error, maybe the Filter interface implementation is not working.

Searched at https://github.com/charmbracelet/bubbletea/tree/master/examples and also tried https://github.com/charmbracelet/bubbletea/issues/155 but didn't work

Contributor guide

Open the contributing guide

Research direction

Start with the reported stack trace at github.com/charmbracelet/bubbles/list/list.go:1211 and review the filtering examples and issue #155 referenced in the report. Reproduce the panic while filtering a list of structs, then verify that struct filtering completes without a nil-pointer panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.