Handle body is None case when decrypting

Heartbeats don't have a payload and body will be None here.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-12-15 12:39:06 +01:00
parent bab012297a
commit 7243414aa0
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -139,7 +139,9 @@ class Plugin(E2EEPlugin):
# Always decrypt. Let us handle how we then warn the user. # Always decrypt. Let us handle how we then warn the user.
allow_untrusted=True, allow_untrusted=True,
) )
body = body.decode('utf-8') # Heartbeats will return a None body.
if body is not None:
body = body.decode('utf-8')
except (MissingOwnKey,): except (MissingOwnKey,):
# The message is missing our own key, it was not encrypted for # The message is missing our own key, it was not encrypted for
# us, and we can't decrypt it. # us, and we can't decrypt it.