From f6cb896bc4c0bafca1acd5ac3fb45169cd893e29 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 22 Oct 2010 17:55:07 -0700 Subject: lib: Fix notmuch_query_search_threads to return NULL on any Xapian exception. Previously, if the underlying search_messages hit an exception and returned NULL, this function would ignore that and return a non-NULL, (but empty) threads object. Fix this to properly propagate the error. --- lib/query.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/query.cc') diff --git a/lib/query.cc b/lib/query.cc index d241dc1d..59f4011b 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -249,6 +249,10 @@ notmuch_query_search_threads (notmuch_query_t *query) free, NULL); threads->messages = notmuch_query_search_messages (query); + if (threads->messages == NULL) { + talloc_free (threads); + return NULL; + } threads->thread_id = NULL; -- cgit v1.2.3