]> kaliko git repositories - python-musicpd.git/commitdiff
mpd.py: clear command list if an exception is raised
authorJ. Alexander Treuman <jat@spatialrift.net>
Thu, 15 Jul 2010 21:52:54 +0000 (17:52 -0400)
committerJ. Alexander Treuman <jat@spatialrift.net>
Thu, 15 Jul 2010 21:52:54 +0000 (17:52 -0400)
This fixes a very longstanding bug where an MPD command error would raise
an exception, but not clear the command list. This would prevent further
commands from being executed until the command list was completed, which
was impossible since the MPD command error broke out of the command list
on the server side.

mpd.py

diff --git a/mpd.py b/mpd.py
index 380f5b1bd5426ea36c2f040820067e0a79386eb1..5e50295df30acb0523d84f5fedd5dfe77048310e 100644 (file)
--- a/mpd.py
+++ b/mpd.py
@@ -269,9 +269,11 @@ class MPDClient(object):
             yield obj
 
     def _read_command_list(self):
-        for retval in self._command_list:
-            yield retval()
-        self._command_list = None
+        try:
+            for retval in self._command_list:
+                yield retval()
+        finally:
+            self._command_list = None
         self._fetch_nothing()
 
     def _iterator_wrapper(self, iterator):