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

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-02-27 23:26:52 +00:00
parent 7449e5c908
commit 4da2bf06e9
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -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: