]> kaliko git repositories - python-musicpd.git/commitdiff
mpd.py: unset iterating flag if an exception is raised
authorJ. Alexander Treuman <jat@spatialrift.net>
Thu, 15 Jul 2010 21:49:53 +0000 (17:49 -0400)
committerJ. Alexander Treuman <jat@spatialrift.net>
Thu, 15 Jul 2010 21:49:53 +0000 (17:49 -0400)
This fixes a bug where an MPD command error would raise an exception, but
leave the iterating flag set, preventing further commands from being
executed.

mpd.py

diff --git a/mpd.py b/mpd.py
index a850bb03da5c50fa1f6d8baa7fe51b23e117309c..380f5b1bd5426ea36c2f040820067e0a79386eb1 100644 (file)
--- a/mpd.py
+++ b/mpd.py
@@ -275,9 +275,11 @@ class MPDClient(object):
         self._fetch_nothing()
 
     def _iterator_wrapper(self, iterator):
-        for item in iterator:
-            yield item
-        self._iterating = False
+        try:
+            for item in iterator:
+                yield item
+        finally:
+            self._iterating = False
 
     def _wrap_iterator(self, iterator):
         if not self.iterate: