Skip to content

Commit

Permalink
allow zero length publish
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Sep 14, 2024
1 parent 0bbb75a commit 9d026d7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion lwesp/src/apps/mqtt/lwesp_mqtt_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ lwesp_mqtt_client_publish(lwesp_mqtt_client_p client, const char* topic, const v
if (qos_u8) {
prv_write_u16(client, pkt_id); /* Write packet ID */
}
if (payload != NULL && payload_len) {
if (payload != NULL && payload_len > 0) {
prv_write_data(client, payload, payload_len); /* Write RAW topic payload */
}
prv_request_set_pending(client, request); /* Set request as pending waiting for server reply */
Expand Down
2 changes: 0 additions & 2 deletions lwesp/src/apps/mqtt/lwesp_mqtt_client_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,6 @@ lwesp_mqtt_client_api_publish(lwesp_mqtt_client_api_p client, const char* topic,

LWESP_ASSERT(client != NULL);
LWESP_ASSERT(topic != NULL);
LWESP_ASSERT(data != NULL);
LWESP_ASSERT(btw > 0);

lwesp_sys_mutex_lock(&client->mutex);
lwesp_sys_sem_wait(&client->sync_sem, 0);
Expand Down

0 comments on commit 9d026d7

Please sign in to comment.