From: J. Alexander Treuman Date: Thu, 15 Jul 2010 21:49:53 +0000 (-0400) Subject: mpd.py: unset iterating flag if an exception is raised X-Git-Tag: v0.3.0~20 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=a55e3f15d6d53355acae2d809e1a5c512115b0dc;p=python-musicpd.git mpd.py: unset iterating flag if an exception is raised 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. --- diff --git a/mpd.py b/mpd.py index a850bb0..380f5b1 100644 --- 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: