1
0
mirror of https://github.com/danog/ytop.git synced 2024-11-27 04:24:45 +01:00

Add check for length of cpu_percents_percpu

This commit is contained in:
Caleb Bassi 2020-01-18 15:12:21 -08:00
parent c558655aae
commit b888ede904

View File

@ -99,8 +99,13 @@ impl UpdatableWidget for CpuWidget<'_> {
}
if self.show_percpu {
let percpu_percents = self.collector.cpu_percent_percpu().unwrap();
for i in 0..self.cpu_count {
self.percpu_data[i].push((self.update_count as f64, percpu_percents[i].into()));
if percpu_percents.len() != self.cpu_count {
// TODO
} else {
#[allow(clippy::needless_range_loop)]
for i in 0..self.cpu_count {
self.percpu_data[i].push((self.update_count as f64, percpu_percents[i].into()));
}
}
}
}