From d8f7b15111fcbb7e2da67682824f850a68dde38c Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 20 Aug 2020 00:40:02 +0200 Subject: [PATCH] Post ZeroconfServiceRemovedEvent also if the zeroconf_info object has already been deallocated --- platypush/backend/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platypush/backend/__init__.py b/platypush/backend/__init__.py index ddd28d7e..1aaa339c 100644 --- a/platypush/backend/__init__.py +++ b/platypush/backend/__init__.py @@ -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