summaryrefslogtreecommitdiffstats
path: root/streaming/receiver.c
diff options
context:
space:
mode:
Diffstat (limited to 'streaming/receiver.c')
-rw-r--r--streaming/receiver.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/streaming/receiver.c b/streaming/receiver.c
index 39a606e291..380d49137c 100644
--- a/streaming/receiver.c
+++ b/streaming/receiver.c
@@ -11,10 +11,12 @@ static void rrdpush_receiver_thread_cleanup(void *ptr) {
struct receiver_state *rpt = (struct receiver_state *) ptr;
// Make sure that we detach this thread and don't kill a freshly arriving receiver
- netdata_mutex_lock(&rpt->host->receiver_lock);
- if (rpt->host->receiver == rpt)
- rpt->host->receiver = NULL;
- netdata_mutex_unlock(&rpt->host->receiver_lock);
+ if (rpt->host) {
+ netdata_mutex_lock(&rpt->host->receiver_lock);
+ if (rpt->host->receiver == rpt)
+ rpt->host->receiver = NULL;
+ netdata_mutex_unlock(&rpt->host->receiver_lock);
+ }
info("STREAM %s [receive from [%s]:%s]: receive thread ended (task id %d)", rpt->hostname, rpt->client_ip, rpt->client_port, gettid());