From c786ac3b2a970d136b6e89e9f0b1b38b0e8cec32 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 26 Dec 2011 12:54:06 +1100 Subject: [PATCH] Prevent crash from statline dereference if cgminer is quit before setting up fully. --- main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 4ec49d1f..877d5071 100644 --- a/main.c +++ b/main.c @@ -2026,8 +2026,10 @@ static void text_print_status(int thr_id) struct cgpu_info *cgpu = thr_info[thr_id].cgpu; char logline[255]; - get_statline(logline, cgpu); - printf("%s\n", logline); + if (cgpu) { + get_statline(logline, cgpu); + printf("%s\n", logline); + } } /* Must be called with curses mutex lock held and curses_active */ @@ -5339,8 +5341,10 @@ static void log_print_status(int thr_id) char logline[255]; cgpu = thr_info[thr_id].cgpu; - get_statline(logline, cgpu); - applog(LOG_WARNING, "%s", logline); + if (cgpu) { + get_statline(logline, cgpu); + applog(LOG_WARNING, "%s", logline); + } } static void print_summary(void)