Skip to content

Commit 177e568

Browse files
committed
Add extra check to cross signing key parser
1 parent 72fb0f6 commit 177e568

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mautrix/types/crypto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ def first_ed25519_key(self) -> Optional[SigningKey]:
7171
return self.first_key_with_algorithm(EncryptionKeyAlgorithm.ED25519)
7272

7373
def first_key_with_algorithm(self, alg: EncryptionKeyAlgorithm) -> Optional[SigningKey]:
74+
if not self.keys:
75+
return None
7476
try:
7577
return next(key for key_id, key in self.keys.items() if key_id.algorithm == alg)
7678
except StopIteration:

0 commit comments

Comments
 (0)