mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 04:32:55 +00:00
Fix sigsegv if cpu_usage has not yet been populated (seen on 1.8.0_rc1)
This commit is contained in:
parent
7ff762e4af
commit
2568030509
@ -494,12 +494,20 @@ uint8_t cpu_percentage(struct text_object *obj)
|
||||
obj->data.i, info.cpu_count);
|
||||
CRIT_ERR(NULL, NULL, "attempting to use more CPUs than you have!");
|
||||
}
|
||||
if (info.cpu_usage) {
|
||||
return round_to_int(info.cpu_usage[obj->data.i] * 100.0);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
double cpu_barval(struct text_object *obj)
|
||||
{
|
||||
if (info.cpu_usage) {
|
||||
return info.cpu_usage[obj->data.i];
|
||||
} else {
|
||||
return 0.;
|
||||
}
|
||||
}
|
||||
|
||||
#define PRINT_HR_GENERATOR(name) \
|
||||
|
Loading…
Reference in New Issue
Block a user