--- /dev/null
+Return-Path: <patricktotzke@googlemail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 53AEC429E25\r
+ for <notmuch@notmuchmail.org>; Tue, 16 Aug 2011 14:38:09 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id oQ1SUKZOHfte for <notmuch@notmuchmail.org>;\r
+ Tue, 16 Aug 2011 14:38:08 -0700 (PDT)\r
+Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
+ [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 8858C431FB6\r
+ for <notmuch@notmuchmail.org>; Tue, 16 Aug 2011 14:38:08 -0700 (PDT)\r
+Received: by wyg36 with SMTP id 36so282360wyg.26\r
+ for <notmuch@notmuchmail.org>; Tue, 16 Aug 2011 14:38:07 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=googlemail.com; s=gamma;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=e/foFuv/74ix7Hz5H9mTdtjiA+uEXct+reAf2lznRVQ=;\r
+ b=rG7Q6Ip0JY/30isGVDXsKZ5P7rwAzLw19nOXZiiEXWNeocc/Q0o0Dz9hQya4nkGif1\r
+ CjjBJq1UH27BYiJbkZbD3G9Oc8QwYz1fOBiO7ISCPnL0pjIMBtdHD9VteJk1yOKx11k1\r
+ +ipKjV56zKh3yPLgRC7+pXf6jcowt+xftbyo4=\r
+Received: by 10.216.72.139 with SMTP id t11mr142930wed.91.1313530687323;\r
+ Tue, 16 Aug 2011 14:38:07 -0700 (PDT)\r
+Received: from localhost (cpc1-sgyl2-0-0-cust47.sgyl.cable.virginmedia.com\r
+ [80.192.18.48])\r
+ by mx.google.com with ESMTPS id z74sm337146weq.23.2011.08.16.14.38.03\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Tue, 16 Aug 2011 14:38:05 -0700 (PDT)\r
+From: Patrick Totzke <patricktotzke@googlemail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] [python] fix unsafe utf-8 decodings\r
+Date: Tue, 16 Aug 2011 22:37:47 +0100\r
+Message-Id: <1313530667-10648-1-git-send-email-patricktotzke@gmail.com>\r
+X-Mailer: git-send-email 1.7.4.1\r
+In-Reply-To: <1313155408-17156-1-git-send-email-patricktotzke@gmail.com>\r
+References: <1313155408-17156-1-git-send-email-patricktotzke@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 16 Aug 2011 21:38:09 -0000\r
+\r
+From: pazz <patricktotzke@gmail.com>\r
+\r
+This prevents unsafe calls to decode for return\r
+value None in get_authors/get_subject\r
+---\r
+ bindings/python/notmuch/tag.py | 4 +++-\r
+ bindings/python/notmuch/thread.py | 10 ++++++++--\r
+ 2 files changed, 11 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py\r
+index d6abf28..9eb9fe2 100644\r
+--- a/bindings/python/notmuch/tag.py\r
++++ b/bindings/python/notmuch/tag.py\r
+@@ -86,7 +86,9 @@ class Tags(object):\r
+ if not nmlib.notmuch_tags_valid(self._tags):\r
+ self._tags = None\r
+ raise StopIteration\r
+- tag = Tags._get(self._tags).decode('utf-8')\r
++ tag = Tags._get(self._tags)\r
++ if tag:\r
++ tag = tag.decode('UTF-8')\r
+ nmlib.notmuch_tags_move_to_next(self._tags)\r
+ return tag\r
+ \r
+diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py\r
+index 120f925..2a55bd9 100644\r
+--- a/bindings/python/notmuch/thread.py\r
++++ b/bindings/python/notmuch/thread.py\r
+@@ -292,7 +292,10 @@ class Thread(object):\r
+ """\r
+ if self._thread is None:\r
+ raise NotmuchError(STATUS.NOT_INITIALIZED)\r
+- return Thread._get_authors(self._thread).decode('UTF-8')\r
++ authors = Thread._get_authors(self._thread)\r
++ if authors:\r
++ return authors.decode('UTF-8')\r
++ return None\r
+ \r
+ def get_subject(self):\r
+ """Returns the Subject of 'thread'\r
+@@ -302,7 +305,10 @@ class Thread(object):\r
+ """\r
+ if self._thread is None:\r
+ raise NotmuchError(STATUS.NOT_INITIALIZED)\r
+- return Thread._get_subject(self._thread).decode('UTF-8')\r
++ subject = Thread._get_subject(self._thread)\r
++ if subject:\r
++ return subject.decode('UTF-8')\r
++ return None\r
+ \r
+ def get_newest_date(self):\r
+ """Returns time_t of the newest message date\r
+-- \r
+1.7.4.1\r
+\r