Prevent accessing list index when no device is available

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent b5f9eb7e
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment