Post ZeroconfServiceRemovedEvent also if the zeroconf_info object has already been deallocated

This commit is contained in:
Fabio Manganiello 2020-08-20 00:40:02 +02:00
parent ddedcd647c
commit d8f7b15111

View file

@ -368,8 +368,11 @@ class Backend(Thread, EventGenerator):
if self.zeroconf:
self.zeroconf.close()
self.bus.post(ZeroconfServiceRemovedEvent(service_type=self.zeroconf_info.type,
service_name=self.zeroconf_info.name))
if self.zeroconf_info:
self.bus.post(ZeroconfServiceRemovedEvent(service_type=self.zeroconf_info.type,
service_name=self.zeroconf_info.name))
else:
self.bus.post(ZeroconfServiceRemovedEvent())
self.zeroconf_info = None
self.zeroconf = None