From 4da2bf06e9528a3b7c2759e70c178c8e01528074 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 23:26:52 +0000 Subject: [PATCH] Prevent accessing list index when no device is available also in _store_device_ids 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slixmpp_omemo/__init__.py b/slixmpp_omemo/__init__.py index cc1cec3..e3bbd28 100644 --- a/slixmpp_omemo/__init__.py +++ b/slixmpp_omemo/__init__.py @@ -286,7 +286,8 @@ class XEP_0384(BasePlugin): """Store Device list""" device_ids = [] # type: List[int] items = list(items) - device_ids = [int(d['id']) for d in items[0]['devices']] + if items: + device_ids = [int(d['id']) for d in items[0]['devices']] return self._omemo.newDeviceList(str(jid), device_ids) def _receive_device_list(self, msg: Message) -> None: