fix(sysinfo): validate array before assignment

resolves #2672
This commit is contained in:
Jan De Dobbeleer 2022-08-17 13:35:47 +02:00 committed by Jan De Dobbeleer
parent d2e50e9c87
commit 698cbc4135

View file

@ -77,7 +77,7 @@ func (s *SystemInfo) Init(props properties.Properties, env environment.Environme
}
// times
processorTimes, err := cpu.Percent(0, false)
if err == nil {
if err == nil && len(processorTimes) > 0 {
s.Times = processorTimes[0]
}
// cpu