From 93f9e965a8404b1ccdecf673e360d904a2c40dcd Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 6 Nov 2018 22:59:57 +0000 Subject: [PATCH] Only remove context from hash if there is a client id. This should never happen, but just in case. --- src/loop.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/loop.c b/src/loop.c index 97147209..002fb24f 100644 --- a/src/loop.c +++ b/src/loop.c @@ -638,9 +638,11 @@ void do_disconnect(struct mosquitto_db *db, struct mosquitto *context) context->sock = INVALID_SOCKET; context->pollfd_index = -1; } - HASH_DELETE(hh_id, db->contexts_by_id, context); - context->old_id = context->id; - context->id = NULL; + if(context->id){ + HASH_DELETE(hh_id, db->contexts_by_id, context); + context->old_id = context->id; + context->id = NULL; + } }else #endif {