src/eric7/EricCore/EricFileSystemWatcher.py

branch
eric7
changeset 10993
b83dd2d57e43
parent 10922
36a90a94765c
child 11090
f5f5f5803935
diff -r c3b070373492 -r b83dd2d57e43 src/eric7/EricCore/EricFileSystemWatcher.py
--- a/src/eric7/EricCore/EricFileSystemWatcher.py	Mon Oct 21 11:40:11 2024 +0200
+++ b/src/eric7/EricCore/EricFileSystemWatcher.py	Mon Oct 21 11:49:13 2024 +0200
@@ -254,7 +254,7 @@
         @return flag indicating a successful creation of a watch for the given path
         @rtype bool
         """
-        if os.path.exists(path):
+        if os.path.exists(path) and self.__observer is not None:
             try:
                 self.__paths[path][1] += 1
                 return True
@@ -315,7 +315,8 @@
             self.__paths[path][1] -= 1
             if self.__paths[path][1] == 0:
                 watch, _ = self.__paths.pop(path)
-                self.__observer.unschedule(watch)
+                if self.__observer is not None:
+                    self.__observer.unschedule(watch)
             return True
         except KeyError:
             return False

eric ide

mercurial