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:
parent
0d806eeb6e
commit
f93df2fd49
1 changed files with 1 additions and 1 deletions
|
@ -25,7 +25,7 @@ class ZeroconfListener(zeroconf.ServiceListener):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_service_info(info: ServiceInfo) -> dict:
|
def parse_service_info(info: ServiceInfo) -> dict:
|
||||||
return {
|
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,
|
'port': info.port,
|
||||||
'host_ttl': info.host_ttl,
|
'host_ttl': info.host_ttl,
|
||||||
'other_ttl': info.other_ttl,
|
'other_ttl': info.other_ttl,
|
||||||
|
|
Loading…
Reference in a new issue