Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 64 / 237a5bc90a99ac600cc97393e7a35dfb37b20e
1 Return-Path: <bremner@tethera.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 207A2431FC2\r
6         for <notmuch@notmuchmail.org>; Wed, 22 Jan 2014 08:43:23 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id Nn-n0HHyTOXP for <notmuch@notmuchmail.org>;\r
16         Wed, 22 Jan 2014 08:43:15 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id A7602431FAF\r
21         for <notmuch@notmuchmail.org>; Wed, 22 Jan 2014 08:43:15 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tethera.net>)\r
24         id 1W60tU-0002Ls-K2; Wed, 22 Jan 2014 12:43:12 -0400\r
25 Received: (nullmailer pid 28647 invoked by uid 1000); Wed, 22 Jan 2014\r
26         16:43:08 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [PATCH] lib: make notmuch_threads_valid return FALSE when passed NULL\r
30 Date: Wed, 22 Jan 2014 12:42:59 -0400\r
31 Message-Id: <1390408979-28606-1-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 1.8.5.2\r
33 In-Reply-To: <8738kgrxyf.fsf@zancas.localnet>\r
34 References: <8738kgrxyf.fsf@zancas.localnet>\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.13\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Wed, 22 Jan 2014 16:43:23 -0000\r
48 \r
49 Without this patch, the example code in the header docs crashes for certain\r
50 invalid queries (see id:871u00oimv.fsf@approx.mit.edu)\r
51 ---\r
52  lib/notmuch.h | 2 ++\r
53  lib/query.cc  | 3 +++\r
54  2 files changed, 5 insertions(+)\r
55 \r
56 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
57 index 02604c5..68896ae 100644\r
58 --- a/lib/notmuch.h\r
59 +++ b/lib/notmuch.h\r
60 @@ -802,6 +802,8 @@ notmuch_query_destroy (notmuch_query_t *query);\r
61   * valid object. Whereas when this function returns FALSE,\r
62   * notmuch_threads_get will return NULL.\r
63   *\r
64 + * If passed a NULL pointer, this function returns FALSE\r
65 + *\r
66   * See the documentation of notmuch_query_search_threads for example\r
67   * code showing how to iterate over a notmuch_threads_t object.\r
68   */\r
69 diff --git a/lib/query.cc b/lib/query.cc\r
70 index ec60e2e..60ff8bd 100644\r
71 --- a/lib/query.cc\r
72 +++ b/lib/query.cc\r
73 @@ -462,6 +462,9 @@ notmuch_threads_valid (notmuch_threads_t *threads)\r
74  {\r
75      unsigned int doc_id;\r
76  \r
77 +    if (! threads)\r
78 +       return FALSE;\r
79 +\r
80      while (threads->doc_id_pos < threads->doc_ids->len) {\r
81         doc_id = g_array_index (threads->doc_ids, unsigned int,\r
82                                 threads->doc_id_pos);\r
83 -- \r
84 1.8.5.2\r
85 \r