mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
fix panic on no containers
This commit is contained in:
parent
59eafdbb4f
commit
330ba8e188
11
grid.go
11
grid.go
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user