From 215ee79056d7e640cc9513a53f5dc8c18757ae47 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 11 Jul 2011 16:52:18 +1000 Subject: [PATCH] thr_id can be successful as -1 which is wrong and could lead to a crash. --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 8f42f0a4..3833326e 100644 --- a/main.c +++ b/main.c @@ -537,7 +537,7 @@ static inline void print_status(int thr_id) printw("Totals: %s", statusline); clrtoeol(); - if (thr_id && thr_id < gpu_threads) { + if (thr_id >= 0 && thr_id < gpu_threads) { int gpu = gpu_from_thr_id(thr_id); struct cgpu_info *cgpu = &gpus[gpu]; @@ -547,7 +547,7 @@ static inline void print_status(int thr_id) cgpu->getworks, cgpu->accepted, cgpu->rejected, cgpu->hw_errors, cgpu->efficiency, cgpu->utility); clrtoeol(); - } else if (thr_id && thr_id >= gpu_threads) { + } else if (thr_id >= gpu_threads) { int cpu = cpu_from_thr_id(thr_id); struct cgpu_info *cgpu = &cpus[cpu];