gizak / termui

Golang terminal dashboard
MIT License
13.23k stars 786 forks source link

If Plot data is empty, Index out of range is thrown #282

Open nerdynick opened 4 years ago

nerdynick commented 4 years ago
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.