From 78141fe5f3d3e8267b6969690b93dd7aba41cf65 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Thu, 7 Oct 2010 09:17:28 -0400 Subject: [PATCH] Fixed dealing with deleting handlers. The call to .index() may raise a ValueError if the item is not in the list. So both the .index() and .pop() calls should be in the try block. --- sleekxmpp/xmlstream/xmlstream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index b7382c82..60adfb2a 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -492,8 +492,8 @@ class XMLStream(object): # remove it now instead of waiting for it to be # processed in the queue. with self.__event_handlers_lock: - handler_index = self.__event_handlers[name].index(handler) try: + handler_index = self.__event_handlers[name].index(handler) self.__event_handlers[name].pop(handler_index) except: pass