]> git.michaelhowe.org Git - packages/p/paho-mqtt.git/commitdiff
Handle null will payloads correctly when connecting.
authorRoger Light <roger@atchoo.org>
Sat, 7 Dec 2013 23:50:03 +0000 (23:50 +0000)
committerRoger Light <roger@atchoo.org>
Mon, 3 Feb 2014 21:20:23 +0000 (21:20 +0000)
src/paho/mqtt/client.py

index 47b23a4478231db1aa3ac4f830e4d1abb7efd398..4ea4d98ab24e946581df7b15126bb034afee2924 100755 (executable)
@@ -1598,7 +1598,11 @@ class Client:
             connect_flags = connect_flags | 0x02
 
         if self._will:
-            remaining_length = remaining_length + 2+len(self._will_topic) + 2+len(self._will_payload)
+            if self._will_payload is not None:
+                remaining_length = remaining_length + 2+len(self._will_topic) + 2+len(self._will_payload)
+            else:
+                remaining_length = remaining_length + 2+len(self._will_topic) + 2
+
             connect_flags = connect_flags | 0x04 | ((self._will_qos&0x03) << 3) | ((self._will_retain&0x01) << 5)
 
         if self._username: