From 5c555deb64c75b2a6f04dc9c6b52756897567483 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Tue, 19 Oct 2010 17:36:29 -0700 Subject: [PATCH] Fix for segfault in top_name stuff. --- src/top.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/top.c b/src/top.c index 18b4ee6..29b169b 100644 --- a/src/top.c +++ b/src/top.c @@ -986,9 +986,11 @@ void print_top(struct text_object *obj, char *p, int p_max_size) switch (td->type) { case TOP_NAME: - width = MIN(p_max_size, (int)top_name_width + 1); - snprintf(p, width + 1, "%-*s", width, - needed[td->num]->name); + if (needed[td->num]->name) { + width = MIN(p_max_size, (int)top_name_width + 1); + snprintf(p, width + 1, "%-*s", width, + needed[td->num]->name); + } break; case TOP_CPU: width = MIN(p_max_size, 7); -- 1.7.9.5