Prevent accessing list index when no device is available

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-02-27 09:24:23 +00:00
parent b5f9eb7e87
commit be9139957c
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -302,7 +302,9 @@ class XEP_0384(BasePlugin):
self._store_device_ids(bare_jid, items) self._store_device_ids(bare_jid, items)
items = list(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 \ if bare_jid == self.xmpp.boundjid.bare and \
self._device_id not in device_ids: self._device_id not in device_ids: