From: Vincent A Date: Sun, 27 Jan 2019 08:40:17 +0000 (+0100) Subject: python: fix get_property error when property doesn't exist X-Git-Tag: archive/debian/0.29_rc0-1~135 X-Git-Url: https://git.cworth.org/git?p=notmuch;a=commitdiff_plain;h=872bd134e3ba860236661a202965a3d7447e7af7 python: fix get_property error when property doesn't exist In Python bindings, Message.get_property fails with an AttributeError when trying to fetch a property that doesn't exist. From d712832ba982085975c27b23bb502af82e638b39 Mon Sep 17 00:00:00 2001 From: hydrargyrum Date: Sun, 6 Jan 2019 16:08:55 +0100 Subject: [PATCH] python: fix get_property error when property doesn't exist --- diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py index de0fb415..6e32b5f7 100644 --- a/bindings/python/notmuch/message.py +++ b/bindings/python/notmuch/message.py @@ -482,7 +482,9 @@ class Message(Python3StringMixIn): if status != 0: raise NotmuchError(status) - return value.value.decode('utf-8') if value is not None else None + if value is None or value.value is None: + return None + return value.value.decode('utf-8') def get_properties(self, prop="", exact=False): """ Get the properties of the message, returning a generator of