mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
prevent panic on container IDs < 12 chars
This commit is contained in:
parent
350cb09338
commit
da09b95d29
@ -31,10 +31,14 @@ type Container struct {
|
||||
|
||||
func New(id string, collector collector.Collector, manager manager.Manager) *Container {
|
||||
widgets := compact.NewCompactRow()
|
||||
shortID := id
|
||||
if len(shortID) > 12 {
|
||||
shortID = shortID[0:12]
|
||||
}
|
||||
return &Container{
|
||||
Metrics: models.NewMetrics(),
|
||||
Id: id,
|
||||
Meta: models.NewMeta("id", id[:12]),
|
||||
Meta: models.NewMeta("id", shortID),
|
||||
Widgets: widgets,
|
||||
updater: widgets,
|
||||
collector: collector,
|
||||
|
Loading…
Reference in New Issue
Block a user