diff --git a/src/calibre/gui2/tweak_book/completion/worker.py b/src/calibre/gui2/tweak_book/completion/worker.py index a9d75f6bff..cb8cba21a9 100644 --- a/src/calibre/gui2/tweak_book/completion/worker.py +++ b/src/calibre/gui2/tweak_book/completion/worker.py @@ -139,7 +139,7 @@ class CompletionWorker(Thread): def shutdown(self): self.shutting_down = True self.main_queue.put(None) - for conn in (self.control_conn, self.data_conn): + for conn in (getattr(self, 'control_conn', None), getattr(self, 'data_conn', None)): try: conn.close() except Exception: