summaryrefslogtreecommitdiffstats
path: root/src/mqtt
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@qt.io>2019-06-28 14:53:51 +0200
committerMaurice Kalinowski <maurice.kalinowski@qt.io>2019-07-02 12:52:04 +0200
commitd25a0abe78648b0e2fbf4ac6d4e3b325e88dfb42 (patch)
treea694a3c4d1d06fa8066084711de34db09d7ccc15 /src/mqtt
parent23febf55174a92fe93c06e63cb66e4a1fc7ca089 (diff)
Allow empty will messages
A will message is allowed to be empty. Hence, check whether a will topic exists to identify incorporating the last will to the connect message. Task-number: QTBUG-76783 Change-Id: Ifb7f5467e8e7e70c6d9c050b36a35df2419f4171 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/mqtt')
-rw-r--r--src/mqtt/qmqttconnection.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mqtt/qmqttconnection.cpp b/src/mqtt/qmqttconnection.cpp
index bbad0bd..e3beb56 100644
--- a/src/mqtt/qmqttconnection.cpp
+++ b/src/mqtt/qmqttconnection.cpp
@@ -253,7 +253,7 @@ bool QMqttConnection::sendControlConnect()
if (m_clientPrivate->m_cleanSession)
flags |= 1 << 1;
- if (!m_clientPrivate->m_willMessage.isEmpty()) {
+ if (!m_clientPrivate->m_willTopic.isEmpty()) {
flags |= 1 << 2;
if (m_clientPrivate->m_willQoS > 2) {
qCDebug(lcMqttConnection) << "Invalid Will QoS specified.";
@@ -290,7 +290,7 @@ bool QMqttConnection::sendControlConnect()
packet.append(char(0));
}
- if (!m_clientPrivate->m_willMessage.isEmpty()) {
+ if (!m_clientPrivate->m_willTopic.isEmpty()) {
if (m_clientPrivate->m_protocolVersion == QMqttClient::MQTT_5_0)
packet.appendRaw(writeLastWillProperties());