From 107ae338a18d831434a2ab17ed430a1cb2c7b847 Mon Sep 17 00:00:00 2001 From: wanghaemq Date: Wed, 3 Jan 2024 01:13:28 -0500 Subject: [PATCH] * FIX [hook] Fix the error that access a null pointer. Signed-off-by: wanghaemq --- nanomq/webhook_inproc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nanomq/webhook_inproc.c b/nanomq/webhook_inproc.c index a810cc2bf..4aebe55ec 100644 --- a/nanomq/webhook_inproc.c +++ b/nanomq/webhook_inproc.c @@ -323,7 +323,6 @@ hook_work_cb(void *arg) root = NULL; } if (root) { - cJSON *idjo = cJSON_GetObjectItem(root, "ID"); char *idstr = NULL; if (idjo) idstr = idjo->valuestring; @@ -361,14 +360,15 @@ hook_work_cb(void *arg) msg = work->msg; work->msg = NULL; - // TODO match exchange with IPC msg (by MQ name) - nng_socket *ex_sock = exconf->nodes[0]->sock; if (exconf->count == 0) { log_error("Exchange is not enabled"); nng_msg_free(msg); goto skip; } + // TODO match exchange with IPC msg (by MQ name) + nng_socket *ex_sock = exconf->nodes[0]->sock; + body = (char *) nng_msg_body(msg); root = cJSON_Parse(body);