summaryrefslogtreecommitdiffstats
path: root/staslib/avahi.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--staslib/avahi.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/staslib/avahi.py b/staslib/avahi.py
index c8a3a0b..26543d9 100644
--- a/staslib/avahi.py
+++ b/staslib/avahi.py
@@ -29,9 +29,11 @@ def _txt2dict(txt: list):
for list_of_chars in txt:
try:
string = functools.reduce(lambda accumulator, c: accumulator + chr(c), list_of_chars, '')
- key, val = string.split("=")
- the_dict[key.lower()] = val
- except Exception: # pylint: disable=broad-except
+ if string.isprintable():
+ key, val = string.split('=')
+ if key: # Make sure the key is not an empty string
+ the_dict[key.lower()] = val
+ except ValueError:
pass
return the_dict