From fd305d7b48d07a2e0a63b0fda6e4edf2875b2270 Mon Sep 17 00:00:00 2001 From: Francois BIOT Date: Mon, 10 Apr 2023 12:43:06 +0200 Subject: [PATCH] Fix return value of MqttClient::publish if not connected --- src/TinyMqtt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TinyMqtt.cpp b/src/TinyMqtt.cpp index 83f112f..a356c04 100644 --- a/src/TinyMqtt.cpp +++ b/src/TinyMqtt.cpp @@ -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;