提交 d0297615 编写于 作者: R Roger Light

Raise error on `subscribe()` when `topic` is an empty list.

Closes #690. Thanks to peromvikgoodtech.
上级 bc524e4d
......@@ -3,6 +3,7 @@ v1.6.2 - 2021-xx-xx
- Fix handling of MQTT v5.0 PUBREL messages with remaining length not equal to
2. Closes #696.
- Raise error on `subscribe()` when `topic` is an empty list. Closes #690.
v1.6.1 - 2021-10-21
......
......@@ -54,6 +54,6 @@ mqttc.on_subscribe = on_subscribe
# Uncomment to enable debug messages
# mqttc.on_log = on_log
mqttc.connect("mqtt.eclipseprojects.io", 1883, 60)
mqttc.subscribe("$SYS/#", 0)
mqttc.subscribe([])
mqttc.loop_forever()
......@@ -1467,6 +1467,8 @@ class Client(object):
raise ValueError('Invalid topic.')
topic_qos_list = [(topic.encode('utf-8'), qos)]
elif isinstance(topic, list):
if len(topic) == 0:
raise ValueError('Empty topic list')
topic_qos_list = []
if self._protocol == MQTTv5:
for t, o in topic:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册