Check for *pth dereference on pthread_join
diff --git a/cgminer.c b/cgminer.c
index 607ae80..d65647f 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2810,7 +2810,7 @@ static void __kill_work(void)
if (thr && PTH(thr) != 0L)
pth = &thr->pth;
thr_info_cancel(thr);
- if (pth)
+ if (pth && *pth)
pthread_join(*pth, NULL);
}