Skip to content

Commit 2ec2404

Browse files
author
joerggollnick
committed
outgoing_topic or cmd = None case handled
1 parent 9bf945c commit 2ec2404

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mqttwarn/services/mqtt_filter.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ def plugin(srv, item):
2828
# parse topic
2929
topic=list(map( lambda x: quote(x), item.topic.split('/') ))
3030

31+
outgoing_topic = None
3132
# replace palceholders args[0], args[1] ..., full_topic, topic[0],
32-
outgoing_topic = item.addrs[0].format(args=args,full_topic=quote(item.topic),topic=topic)
33+
if item.addrs[0] is not None:
34+
outgoing_topic = item.addrs[0].format(args=args,full_topic=quote(item.topic),topic=topic)
3335
qos = item.addrs[1]
3436
retain = item.addrs[2]
3537
addrs = item.addrs[3:]
3638

37-
cmd = [i.format(args=args, full_topic=quote(item.topic),topic=topic) for i in addrs]
39+
cmd = None
40+
if addrs is not None:
41+
cmd = [i.format(args=args, full_topic=quote(item.topic),topic=topic) for i in addrs]
3842

3943
srv.logging.debug("*** MODULE=%s: service=%s, command=%s outgoing_topic=%s", __file__, item.service, str( cmd ),outgoing_topic)
4044

0 commit comments

Comments
 (0)