From 7243414aa08d66d6dc210eebdc2686c924f69148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 15 Dec 2021 12:39:06 +0100 Subject: [PATCH] Handle body is None case when decrypting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Heartbeats don't have a payload and body will be None here. Signed-off-by: Maxime “pep” Buquet --- poezio_omemo/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/poezio_omemo/__init__.py b/poezio_omemo/__init__.py index 4eba924..4c828c2 100644 --- a/poezio_omemo/__init__.py +++ b/poezio_omemo/__init__.py @@ -139,7 +139,9 @@ class Plugin(E2EEPlugin): # Always decrypt. Let us handle how we then warn the user. 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,): # The message is missing our own key, it was not encrypted for # us, and we can't decrypt it.