diff --git a/src/plugins/select/cons_res/job_test.c b/src/plugins/select/cons_res/job_test.c index 3cf4477392cbcb753032edcb3224c0df24b4b6fa..ab47e93afae2ac4782acd2df2a2a4f6b0234c004 100644 --- a/src/plugins/select/cons_res/job_test.c +++ b/src/plugins/select/cons_res/job_test.c @@ -1322,7 +1322,7 @@ static int _eval_nodes_topo(struct job_record *job_ptr, bitstr_t *bitmap, for (j=0; j<switch_record_cnt; j++) { first = bit_ffs(switches_bitmap[j]); last = bit_fls(switches_bitmap[j]); - for (i=first; i<=last; i++) { + for (i=first; ((i<=last) && (first>=0)); i++) { if (!bit_test(switches_bitmap[j], i)) continue; switches_cpu_cnt[j] +=