Avoid calling mg_send on no actual payload

This commit is contained in:
Sergio R. Caprile 2023-12-29 14:58:03 -03:00
parent 744df7b244
commit 2427c40a4c
2 changed files with 2 additions and 2 deletions

View File

@ -3990,7 +3990,7 @@ void mg_mqtt_pub(struct mg_connection *c, const struct mg_mqtt_opts *opts) {
if (c->is_mqtt5) mg_send_mqtt_properties(c, opts->props, opts->num_props);
mg_send(c, opts->message.ptr, opts->message.len);
if (opts->message.len > 0) mg_send(c, opts->message.ptr, opts->message.len);
}
void mg_mqtt_sub(struct mg_connection *c, const struct mg_mqtt_opts *opts) {

View File

@ -338,7 +338,7 @@ void mg_mqtt_pub(struct mg_connection *c, const struct mg_mqtt_opts *opts) {
if (c->is_mqtt5) mg_send_mqtt_properties(c, opts->props, opts->num_props);
mg_send(c, opts->message.ptr, opts->message.len);
if (opts->message.len > 0) mg_send(c, opts->message.ptr, opts->message.len);
}
void mg_mqtt_sub(struct mg_connection *c, const struct mg_mqtt_opts *opts) {