From 288f6aa1005d62be92f5c958a7e5262e62b096ec Mon Sep 17 00:00:00 2001 From: souliane Date: Tue, 24 Nov 2015 10:39:22 +0100 Subject: [PATCH] plugin sec_otr: fixes bad handling of entity disconnection --- src/plugins/plugin_sec_otr.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/plugin_sec_otr.py b/src/plugins/plugin_sec_otr.py index 19d64f03..8b135509 100644 --- a/src/plugins/plugin_sec_otr.py +++ b/src/plugins/plugin_sec_otr.py @@ -476,7 +476,11 @@ class OTR(object): if show != C.PRESENCE_UNAVAILABLE: return True if not entity.resource: - entity.resource = self.host.memory.getMainResource(entity, profile) # FIXME: temporary and unsecure, must be changed when frontends are refactored - otrctx = self.context_managers[profile].getContextForUser(entity) - otrctx.disconnect() + try: + entity.resource = self.host.memory.getMainResource(entity, profile) # FIXME: temporary and unsecure, must be changed when frontends are refactored + except exceptions.UnknownEntityError: + return True # entity was not connected + if entity in self.context_managers[profile].contexts: + otrctx = self.context_managers[profile].getContextForUser(entity) + otrctx.disconnect() return True