From eb8709a5939709af2c4da43e996538a07e2f502d Mon Sep 17 00:00:00 2001 From: Mateus Meyer Jiacomelli Date: Mon, 21 Feb 2022 21:37:25 +0000 Subject: [PATCH] Zeroconf startup crash --- openlp/core/api/zeroconf.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openlp/core/api/zeroconf.py b/openlp/core/api/zeroconf.py index 04cf5345d..f2d65c350 100644 --- a/openlp/core/api/zeroconf.py +++ b/openlp/core/api/zeroconf.py @@ -79,8 +79,9 @@ class ZeroconfWorker(ThreadWorker): addresses=addresses, port=self.http_port, properties={}) ws_info = ServiceInfo('_ws._tcp.local.', 'OpenLP._ws._tcp.local.', addresses=addresses, port=self.ws_port, properties={}) - zc = Zeroconf() + zc = None try: + zc = Zeroconf() zc.register_service(http_info) zc.register_service(ws_info) self._can_run = True @@ -88,9 +89,12 @@ class ZeroconfWorker(ThreadWorker): sleep(0.1) except Error as e: self.error.emit('Cannot start Zeroconf service', _get_error_message(e)) + except OSError as e: + self.error.emit('Cannot start Zeroconf service', str(e)) finally: - zc.unregister_all_services() - zc.close() + if zc is not None: + zc.unregister_all_services() + zc.close() self.quit.emit() def stop(self):