fix panic on no containers

This commit is contained in:
Bradley Cicenas 2017-01-25 19:57:22 +00:00
parent 59eafdbb4f
commit 330ba8e188

11
grid.go
View File

@ -16,13 +16,16 @@ type Grid struct {
func NewGrid() *Grid {
cmap := NewContainerMap()
containers := cmap.All()
return &Grid{
cursorID: containers[0].id,
g := &Grid{
cmap: cmap,
containers: containers,
containers: cmap.All(),
header: widgets.NewCTopHeader(),
}
// set initial cursor position
if len(g.containers) > 0 {
g.cursorID = g.containers[0].id
}
return g
}
// Return current cursor index