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