[cpu][linux]: add cpuinfo parse check.

This commit is contained in:
shirou 2019-11-14 21:47:42 +09:00
parent 7c51a74806
commit b0025409e9
1 changed files with 1 additions and 1 deletions

View File

@ -87,7 +87,7 @@ func finishCPUInfo(c *InfoStat) error {
lines, err = common.ReadLines(sysCPUPath(c.CPU, "cpufreq/cpuinfo_max_freq"))
// if we encounter errors below such as there are no cpuinfo_max_freq file,
// we just ignore. so let Mhz is 0.
if err != nil {
if err != nil || len(lines) == 0 {
return nil
}
value, err = strconv.ParseFloat(lines[0], 64)