From 8a93c54abedfe0f0b9f170aab96969304a3a42d8 Mon Sep 17 00:00:00 2001 From: Cesare Tirabassi Date: Tue, 5 Jan 2010 17:08:20 +0100 Subject: [PATCH] Fix sigsegv if cpu_usage has not yet been populated --- src/conky.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/conky.c b/src/conky.c index 8eab0e6..fdc5996 100644 --- a/src/conky.c +++ b/src/conky.c @@ -899,8 +899,10 @@ void generate_text_internal(char *p, int p_max_size, obj->data.i, info.cpu_count); CRIT_ERR(NULL, NULL, "attempting to use more CPUs than you have!"); } - percent_print(p, p_max_size, + if (cur->cpu_usage) { + percent_print(p, p_max_size, round_to_int(cur->cpu_usage[obj->data.i] * 100.0)); + } } OBJ(cpugauge) new_gauge(obj, p, p_max_size, round_to_int(cur->cpu_usage[obj->data.i] * 255.0)); -- 1.7.9.5