From: meejah <meejah@meejah.ca>
Date: Tue, 8 Dec 2015 16:24:05 +0000 (-0800)
Subject: don't do callbacks if we don't have any
X-Git-Url: https://git.rkrishnan.org/specifications/components/cyclelanguage?a=commitdiff_plain;h=5b9c92caccfb79eae30ea487b9c0a175cdefa8fe;p=tahoe-lafs%2Ftahoe-lafs.git

don't do callbacks if we don't have any
---

diff --git a/src/allmydata/windows/inotify.py b/src/allmydata/windows/inotify.py
index 4e7bc904..71d0f34e 100644
--- a/src/allmydata/windows/inotify.py
+++ b/src/allmydata/windows/inotify.py
@@ -272,11 +272,12 @@ class INotify(PollMixin):
                             self._pending.add(path)
                             def _do_callbacks():
                                 self._pending.remove(path)
-                                for cb in self._callbacks:
-                                    try:
-                                        cb(None, path, IN_CHANGED)
-                                    except Exception, e:
-                                        log.err(e)
+                                if self._callbacks:
+                                    for cb in self._callbacks:
+                                        try:
+                                            cb(None, path, IN_CHANGED)
+                                        except Exception, e:
+                                            log.err(e)
                             reactor.callLater(self._pending_delay, _do_callbacks)
                     reactor.callFromThread(_maybe_notify, path)
         except Exception, e: