From edb5e20de672e0aca9cc34afa39401ea7cb952fb Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 12 Jun 2023 15:10:48 +0200 Subject: [PATCH] Bug fix - Fixed crash when deleting watch from UI when watch was already manually deleted from datadir (#1623) --- changedetectionio/store.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/changedetectionio/store.py b/changedetectionio/store.py index 5e071ce5..0b8002c9 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -204,15 +204,16 @@ class ChangeDetectionStore: # GitHub #30 also delete history records for uuid in self.data['watching']: path = pathlib.Path(os.path.join(self.datastore_path, uuid)) - shutil.rmtree(path) - self.needs_write_urgent = True + if os.path.exists(path): + shutil.rmtree(path) else: path = pathlib.Path(os.path.join(self.datastore_path, uuid)) - shutil.rmtree(path) + if os.path.exists(path): + shutil.rmtree(path) del self.data['watching'][uuid] - self.needs_write_urgent = True + self.needs_write_urgent = True # Clone a watch by UUID def clone(self, uuid):