--- /dev/null
+Return-Path: <jani@nikula.org>\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 28E82431FBD\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 13:06:45 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[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 qo5D0XjJ7w2Z for <notmuch@notmuchmail.org>;\r
+ Fri, 24 Jan 2014 13:06:35 -0800 (PST)\r
+Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
+ [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 5F85C431FB6 for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 13:06:35 -0800\r
+ (PST)\r
+Received: by mail-ee0-f53.google.com with SMTP id t10so1200353eei.40\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 13:06:32 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:in-reply-to:references\r
+ :user-agent:date:message-id:mime-version:content-type;\r
+ bh=27KuWtQW9iXq95Ap/jKvQ9n/FMUT+QwrRFO+cEekh7U=;\r
+ b=aM4wI8SQFipICTC+UOE3yYpCMbqG6BGoILfpNDPbzJWsyBjf/daxwUkadN3uza7QCn\r
+ IRoVotL7lj8o9x7EEqVmYmgNaF9TPeMBF5tOXr/7PcXgU05W13bnO0+gexISEQzmkf6M\r
+ vBRaotyiNFzLW45nwvtWeN52qouG3zyC8RMxK22iHVGVHPg80x0/pze1VmGFrnndM18U\r
+ CKyLwPgVStr2ji+MjXNu7ZoXKc44VyqYQq8dD91C7fFvlnm1s796AJkB0aT1jr8R7haF\r
+ rwLdp9C9pHQB0ziTueFykuQZ9RAPWQBfbVPeEnBW7GkeybaozEWPlJWt26cDsrY11MLW\r
+ vgQg==\r
+X-Gm-Message-State:\r
+ ALoCoQl6+kHBs7c6fV00yV14E6gPS4epRBPuS9RXdsLgJdJDENjStjeQl0JIJZlEBz0GXJaVAULi\r
+X-Received: by 10.14.100.71 with SMTP id y47mr4445636eef.91.1390597591326;\r
+ Fri, 24 Jan 2014 13:06:31 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+ [88.195.111.91])\r
+ by mx.google.com with ESMTPSA id 8sm7860282eeq.15.2014.01.24.13.06.29\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Fri, 24 Jan 2014 13:06:30 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 2/3] lib: make notmuch_threads_valid return FALSE when\r
+ passed NULL\r
+In-Reply-To: <1390479841-17045-3-git-send-email-david@tethera.net>\r
+References: <m2r47zrkkc.fsf@guru.guru-group.fi>\r
+ <1390479841-17045-1-git-send-email-david@tethera.net>\r
+ <1390479841-17045-3-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.17+44~ge3b4cd9 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 24 Jan 2014 23:06:28 +0200\r
+Message-ID: <87wqhpf5t7.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Fri, 24 Jan 2014 21:06:45 -0000\r
+\r
+On Thu, 23 Jan 2014, David Bremner <david@tethera.net> wrote:\r
+> Without this patch, the example code in the header docs crashes for certain\r
+> invalid queries (see id:871u00oimv.fsf@approx.mit.edu)\r
+> ---\r
+> lib/notmuch.h | 2 ++\r
+> lib/query.cc | 3 +++\r
+> 2 files changed, 5 insertions(+)\r
+>\r
+> diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+> index 02604c5..68896ae 100644\r
+> --- a/lib/notmuch.h\r
+> +++ b/lib/notmuch.h\r
+> @@ -802,6 +802,8 @@ notmuch_query_destroy (notmuch_query_t *query);\r
+> * valid object. Whereas when this function returns FALSE,\r
+> * notmuch_threads_get will return NULL.\r
+> *\r
+> + * If passed a NULL pointer, this function returns FALSE\r
+> + *\r
+> * See the documentation of notmuch_query_search_threads for example\r
+> * code showing how to iterate over a notmuch_threads_t object.\r
+> */\r
+> diff --git a/lib/query.cc b/lib/query.cc\r
+> index ec60e2e..60ff8bd 100644\r
+> --- a/lib/query.cc\r
+> +++ b/lib/query.cc\r
+> @@ -462,6 +462,9 @@ notmuch_threads_valid (notmuch_threads_t *threads)\r
+> {\r
+> unsigned int doc_id;\r
+> \r
+> + if (! threads)\r
+> + return FALSE;\r
+> +\r
+\r
+LGTM, and this is in line with notmuch_messages_valid().\r
+\r
+BR,\r
+Jani.\r
+\r
+> while (threads->doc_id_pos < threads->doc_ids->len) {\r
+> doc_id = g_array_index (threads->doc_ids, unsigned int,\r
+> threads->doc_id_pos);\r
+> -- \r
+> 1.8.5.2\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r