Prevent accessing list index when no device is available also in _store_device_ids

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent 7449e5c9
...@@ -286,7 +286,8 @@ class XEP_0384(BasePlugin): ...@@ -286,7 +286,8 @@ class XEP_0384(BasePlugin):
"""Store Device list""" """Store Device list"""
device_ids = [] # type: List[int] device_ids = [] # type: List[int]
items = list(items) 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) return self._omemo.newDeviceList(str(jid), device_ids)
def _receive_device_list(self, msg: Message) -> None: def _receive_device_list(self, msg: Message) -> None:
......
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