aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-26 05:14:51 -0700
committerCarl Worth <cworth@cworth.org>2009-10-26 05:14:51 -0700
commitb42c4418a401d6192f9c6e8584bc780bb3ff9960 (patch)
treeed44577dd82dee0d2dbc299bb6dd0f213ed6a68a
parente8d8906d9c912d02adbf9ab5ed66f5d6d579fa99 (diff)
results_get: Fix to return NULL if past the end of the results
We had documented both notmuch_thread_results_get and notmuch_message_results_get to return NULL if (! has_more) but we hadn't actually implemented that. Fix.
-rw-r--r--query.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/query.cc b/query.cc
index b454560..5fee854 100644
--- a/query.cc
+++ b/query.cc
@@ -221,6 +221,9 @@ notmuch_message_results_get (notmuch_message_results_t *results)
Xapian::docid doc_id;
notmuch_private_status_t status;
+ if (! notmuch_message_results_has_more (results))
+ return NULL;
+
doc_id = *results->iterator;
message = _notmuch_message_create (results,
@@ -260,6 +263,9 @@ notmuch_thread_results_get (notmuch_thread_results_t *results)
notmuch_thread_t *thread;
const char *thread_id;
+ if (! notmuch_thread_results_has_more (results))
+ return NULL;
+
thread_id = (const char *) g_ptr_array_index (results->thread_ids,
results->index);