From 87a1d62414a7354022519787de03cbec52833f21 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sat, 21 Oct 2023 07:48:09 +0100 Subject: [PATCH] ensure we don't try to join a thread that wasn't created (in the event of a timeout error) --- pyproject.toml | 2 +- vban_cmd/vbancmd.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 779e554..67bdbbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "vban-cmd" -version = "2.4.9" +version = "2.4.10" description = "Python interface for the VBAN RT Packet Service (Sendtext)" authors = ["onyx-and-iris "] license = "MIT" diff --git a/vban_cmd/vbancmd.py b/vban_cmd/vbancmd.py index 7522fb3..e7f35ce 100644 --- a/vban_cmd/vbancmd.py +++ b/vban_cmd/vbancmd.py @@ -51,6 +51,7 @@ class VbanCmd(metaclass=ABCMeta): self._ldirty = False self._script = str() self.stop_event = None + self.producer = None @abstractmethod def __str__(self): @@ -231,8 +232,9 @@ class VbanCmd(metaclass=ABCMeta): if not self.stopped(): self.logger.debug("events thread shutdown started") self.stop_event.set() - for t in (self.producer, self.subscriber): - t.join() + if self.producer is not None: + for t in (self.producer, self.subscriber): + t.join() [sock.close() for sock in self.socks] self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}")