From 698cbc41357e1984c757f8fe9aa387e0257f5469 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Wed, 17 Aug 2022 13:35:47 +0200 Subject: [PATCH] fix(sysinfo): validate array before assignment resolves #2672 --- src/segments/sysinfo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/segments/sysinfo.go b/src/segments/sysinfo.go index 08209cf6..931b3e6e 100644 --- a/src/segments/sysinfo.go +++ b/src/segments/sysinfo.go @@ -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