Fix: Stop client only if it's running.
Check for client run instead of lock to call esp_mqtt_client_stop when destroying the client.
This commit is contained in:
1 parent
effd1e6705
commit
36eec6f625
1 file changed
+1
-1
+1
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user