Skip to content

Commit

Permalink
Fix: Stop client only if it's running.
Browse files Browse the repository at this point in the history
Check for client run instead of lock to call esp_mqtt_client_stop
when destroying the client.
  • Loading branch information
euripedesrocha committed Jun 21, 2023
1 parent effd1e6 commit 36eec6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mqtt_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ esp_err_t esp_mqtt_client_destroy(esp_mqtt_client_handle_t client)
if (client == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (client->api_lock) {
if (client->run) {
esp_mqtt_client_stop(client);
}
esp_mqtt_destroy_config(client);
Expand Down

0 comments on commit 36eec6f

Please sign in to comment.