If Plot data is empty, Index out of range is thrown
- Dominant language
- Go
- Stars
- 13.6k
- Forks
- 819
- PR merge metrics
- No merged PRs in 30d
Description
```
panic: runtime error: index out of range [1] with length 0
goroutine 1 [running]:
github.com/gizak/termui/v3/widgets.(*Plot).renderBraille(0xc0000c03c0, 0xc00025e0f0, 0x6, 0x5, 0x7e, 0x18, 0x0)
/Users/nikoleta/.go/pkg/mod/github.com/gizak/termui/v3@v3.1.0/widgets/plot.go:99 +0x703
github.com/gizak/termui/v3/widgets.(*Plot).Draw(0xc0000c03c0, 0xc00025e0f0)
/Users/nikoleta/.go/pkg/mod/github.com/gizak/termui/v3@v3.1.0/widgets/plot.go:223 +0x123
github.com/gizak/termui/v3.(*Grid).Draw(0xc00024e000, 0xc00025e0f0)
/Users/nikoleta/.go/pkg/mod/github.com/gizak/termui/v3@v3.1.0/grid.go:157 +0x1af
github.com/gizak/termui/v3.Render(0xc0000bd800, 0x1, 0x1)
/Users/nikoleta/.go/pkg/mod/github.com/gizak/termui/v3@v3.1.0/render.go:25 +0x285
```
I'd expect this to just produce no graph/line.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in widgets/plot.go at renderBraille, line 99, using the provided stack trace to reproduce the panic with empty Plot data. Verify the draw path handles an empty dataset without indexing into it, and confirm that rendering produces no graph or line rather than panicking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100