From 94a0d4baaa07c88350542f7ff27114f39fe3aa2f Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 20 Dec 2004 21:47:39 +0000 Subject: [PATCH] Don't seg fault when displaying job info while slurmctld does not respond. --- src/smap/job_functions.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/smap/job_functions.c b/src/smap/job_functions.c index cc4e8d5383a..eed62d684a3 100644 --- a/src/smap/job_functions.c +++ b/src/smap/job_functions.c @@ -33,7 +33,7 @@ static int _print_text_job(job_info_t * job_ptr); extern void get_job(void) { - int error_code = -1, i, j, count = 0; + int error_code = -1, i, j, recs, count = 0; static job_info_msg_t *job_info_ptr = NULL, *new_job_ptr; job_info_t job; @@ -62,7 +62,13 @@ extern void get_job(void) if (!params.no_header) _print_header_job(); - for (i = 0; i < new_job_ptr->record_count; i++) { + + if (new_job_ptr) + recs = new_job_ptr->record_count; + else + recs = 0; + + for (i = 0; i < recs; i++) { job = new_job_ptr->job_array[i]; if (job.node_inx[0] != -1) { job.num_nodes = 0; -- GitLab