1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-15 03:43:50 +00:00

Fix sigsegv if cpu_usage has not yet been populated

This commit is contained in:
Cesare Tirabassi 2010-01-05 17:08:20 +01:00
parent bbb267586a
commit 8a93c54abe

View File

@ -899,9 +899,11 @@ void generate_text_internal(char *p, int p_max_size,
obj->data.i, info.cpu_count); obj->data.i, info.cpu_count);
CRIT_ERR(NULL, NULL, "attempting to use more CPUs than you have!"); CRIT_ERR(NULL, NULL, "attempting to use more CPUs than you have!");
} }
if (cur->cpu_usage) {
percent_print(p, p_max_size, percent_print(p, p_max_size,
round_to_int(cur->cpu_usage[obj->data.i] * 100.0)); round_to_int(cur->cpu_usage[obj->data.i] * 100.0));
} }
}
OBJ(cpugauge) OBJ(cpugauge)
new_gauge(obj, p, p_max_size, round_to_int(cur->cpu_usage[obj->data.i] * 255.0)); new_gauge(obj, p, p_max_size, round_to_int(cur->cpu_usage[obj->data.i] * 255.0));
OBJ(cpubar) { OBJ(cpubar) {