1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-30 05:59:07 +00:00

Fix sigsegv if cpu_usage has not yet been populated (seen on 1.8.0_rc1)

This commit is contained in:
Cesare Tirabassi 2010-01-05 16:59:50 +01:00
parent 7ff762e4af
commit 2568030509

View File

@ -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!");
}
return round_to_int(info.cpu_usage[obj->data.i] * 100.0);
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)
{
return info.cpu_usage[obj->data.i];
if (info.cpu_usage) {
return info.cpu_usage[obj->data.i];
} else {
return 0.;
}
}
#define PRINT_HR_GENERATOR(name) \