From c655c112de5cf14bd0dc37b43db118343f9685da Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Sat, 19 Feb 2022 15:55:08 -0600 Subject: [PATCH] Handle exception when deleting object, if pubsub topic was not subscribed properly --- updater/wxupdater.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/updater/wxupdater.py b/updater/wxupdater.py index 2ffd919..916c53d 100644 --- a/updater/wxupdater.py +++ b/updater/wxupdater.py @@ -33,6 +33,7 @@ import wx # type: ignore import logging from typing import Optional, Any, cast from pubsub import pub # type: ignore +from pubsub.core.topicexc import TopicNameError from platform_utils import paths # type: ignore from . import core, utils @@ -166,4 +167,7 @@ class WXUpdater(core.UpdaterCore): def __del__(self) -> None: """ Unsubscribe events before deleting this object. """ - pub.unsubscribe(self.on_update_progress, "updater.update-progress") \ No newline at end of file + try: + pub.unsubscribe(self.on_update_progress, "updater.update-progress") + except TopicNameError: + pass \ No newline at end of file