From f4b6f8cf43f5877a6aa1379e20ced2b6beaa51fb Mon Sep 17 00:00:00 2001 From: Roger Light Date: Sat, 22 Jun 2013 22:40:00 +0100 Subject: [PATCH] Handle will_payload==None. --- src/paho/mqtt/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 60644b4..7d329be 100755 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -1431,10 +1431,10 @@ class Client: if self._will: self._pack_str16(packet, self._will_topic) - if len(self._will_payload) > 0: - self._pack_str16(packet, self._will_payload) - else: + if self._will_payload == None or len(self._will_payload) == 0: packet.extend(struct.pack("!H", 0)) + else: + self._pack_str16(packet, self._will_payload) if self._username: self._pack_str16(packet, self._username) -- 2.39.5