Fix return value of MqttClient::publish if not connected

This commit is contained in:
Francois BIOT
2023-04-10 12:43:06 +02:00
parent 6339be8044
commit fd305d7b48

View File

@@ -785,7 +785,7 @@ MqttError MqttClient::publish(const Topic& topic, const char* payload, size_t pa
{
return local_broker->publish(this, topic, msg);
}
else if (tcp_client)
else if (tcp_client and connected())
return msg.sendTo(this);
else
return MqttNowhereToSend;