diff --git a/examples/echo_client.py b/examples/echo_client.py index a4ae84e..8239b06 100644 --- a/examples/echo_client.py +++ b/examples/echo_client.py @@ -150,6 +150,11 @@ class EchoBot(ClientXMPP): try: encrypted = msg['omemo_encrypted'] body = self['xep_0384'].decrypt_message(encrypted, mfrom, allow_untrusted) + # decrypt_message returns Optional[str]. It is possible to get + # body-less OMEMO message (see KeyTransportMessages), currently + # used for example to send heartbeats to other devices. + if body is None: + return None decoded = body.decode('utf8') if self.is_command(decoded): await self.handle_command(mto, mtype, decoded)