diff --git a/Sming/Components/Network/src/Network/Mqtt/MqttClient.cpp b/Sming/Components/Network/src/Network/Mqtt/MqttClient.cpp index be7e8896a7..0d9bd1bc7b 100644 --- a/Sming/Components/Network/src/Network/Mqtt/MqttClient.cpp +++ b/Sming/Components/Network/src/Network/Mqtt/MqttClient.cpp @@ -199,11 +199,16 @@ bool MqttClient::setWill(const String& topic, const String& message, uint8_t fla bool MqttClient::connect(const Url& url, const String& clientName) { this->url = url; + bool useSsl{url.Scheme == URI_SCHEME_MQTT_SECURE}; if(!useSsl && url.Scheme != URI_SCHEME_MQTT) { debug_e("Only mqtt and mqtts protocols are allowed"); return false; } + if(clientName == "") { + debug_e("clientName cannot be empty"); + return false; + } if(getConnectionState() != eTCS_Ready) { close();