Skip to content

Commit

Permalink
* FIX [hook] Fix the error that access a null pointer.
Browse files Browse the repository at this point in the history
Signed-off-by: wanghaemq <wangwei@emqx.io>
  • Loading branch information
wanghaEMQ committed Jan 3, 2024
1 parent 5e91bfd commit 107ae33
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nanomq/webhook_inproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 107ae33

Please sign in to comment.