From be9139957c3569428a755f8b173ccb675555f03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 27 Feb 2019 09:24:23 +0000 Subject: [PATCH] Prevent accessing list index when no device is available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- slixmpp_omemo/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/slixmpp_omemo/__init__.py b/slixmpp_omemo/__init__.py index d4d9bba..cc1cec3 100644 --- a/slixmpp_omemo/__init__.py +++ b/slixmpp_omemo/__init__.py @@ -302,7 +302,9 @@ class XEP_0384(BasePlugin): self._store_device_ids(bare_jid, items) items = list(items) - device_ids = [int(d['id']) for d in items[0]['devices']] + device_ids = [] + if items: + device_ids = [int(d['id']) for d in items[0]['devices']] if bare_jid == self.xmpp.boundjid.bare and \ self._device_id not in device_ids: