don't include empty sessions in _chain_lengths method

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-07-16 21:49:55 +02:00
parent 7a887ccac3
commit a2a287ee5d
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -532,6 +532,8 @@ class XEP_0384(BasePlugin):
lengths: ChainLengths = {'sending': [], 'receiving': []} lengths: ChainLengths = {'sending': [], 'receiving': []}
for did in devices: for did in devices:
session = self._omemo._SessionManager__loadSession(bare, did) session = self._omemo._SessionManager__loadSession(bare, did)
if session is None:
break
skr = session._DoubleRatchet__skr skr = session._DoubleRatchet__skr
lengths['sending'].append((did, skr.sending_chain_length)) lengths['sending'].append((did, skr.sending_chain_length))
lengths['receiving'].append((did, skr.receiving_chain_length)) lengths['receiving'].append((did, skr.receiving_chain_length))