summaryrefslogtreecommitdiffstats
path: root/ml
diff options
context:
space:
mode:
Diffstat (limited to 'ml')
-rw-r--r--ml/ml.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/ml/ml.cc b/ml/ml.cc
index 396967492..75f2e727a 100644
--- a/ml/ml.cc
+++ b/ml/ml.cc
@@ -1725,6 +1725,9 @@ void ml_stop_threads()
Cfg.detection_stop = true;
Cfg.training_stop = true;
+ if (!Cfg.detection_thread)
+ return;
+
netdata_thread_cancel(Cfg.detection_thread);
netdata_thread_join(Cfg.detection_thread, NULL);