Avoid the loop on the Zeroconf addresses object if the object is None (e.g. in the context of some tests)

This commit is contained in:
Fabio Manganiello 2021-02-27 20:55:38 +01:00
parent 0d806eeb6e
commit f93df2fd49
1 changed files with 1 additions and 1 deletions

View File

@ -25,7 +25,7 @@ class ZeroconfListener(zeroconf.ServiceListener):
@staticmethod
def parse_service_info(info: ServiceInfo) -> dict:
return {
'addresses': [socket.inet_ntoa(addr) for addr in info.addresses if info and info.addresses],
'addresses': [socket.inet_ntoa(addr) for addr in info.addresses if info.addresses] if info else [],
'port': info.port,
'host_ttl': info.host_ttl,
'other_ttl': info.other_ttl,