From 880c2c9028816c16299771d6a482e4acea90b8f4 Mon Sep 17 00:00:00 2001 From: Paul Praet Date: Sun, 27 Oct 2013 13:39:51 +0100 Subject: Fix crash at CTRL_C --- src/cpulimit.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cpulimit.c b/src/cpulimit.c index 002205d..5c85da2 100644 --- a/src/cpulimit.c +++ b/src/cpulimit.c @@ -88,12 +88,14 @@ int lazy = 0; static void quit(int sig) { //let all the processes continue if stopped - struct list_node *node = NULL; - for (node=pgroup.proclist->first; node!= NULL; node=node->next) { - struct process *p = (struct process*)(node->data); - kill(p->pid, SIGCONT); - } - close_process_group(&pgroup); + if (pgroup.proclist != NULL){ + struct list_node *node = NULL; + for (node=pgroup.proclist->first; node!= NULL; node=node->next) { + struct process *p = (struct process*)(node->data); + kill(p->pid, SIGCONT); + } + close_process_group(&pgroup); + } //fix ^C little problem printf("\r"); fflush(stdout); -- cgit v1.2.3