mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
lib: make notmuch_threads_valid return FALSE when passed NULL
Without this patch, the example code in the header docs crashes for certain invalid queries (see id:871u00oimv.fsf@approx.mit.edu)
This commit is contained in:
parent
5c526d1737
commit
29f1252126
2 changed files with 5 additions and 0 deletions
|
@ -802,6 +802,8 @@ notmuch_query_destroy (notmuch_query_t *query);
|
|||
* valid object. Whereas when this function returns FALSE,
|
||||
* notmuch_threads_get will return NULL.
|
||||
*
|
||||
* If passed a NULL pointer, this function returns FALSE
|
||||
*
|
||||
* See the documentation of notmuch_query_search_threads for example
|
||||
* code showing how to iterate over a notmuch_threads_t object.
|
||||
*/
|
||||
|
|
|
@ -462,6 +462,9 @@ notmuch_threads_valid (notmuch_threads_t *threads)
|
|||
{
|
||||
unsigned int doc_id;
|
||||
|
||||
if (! threads)
|
||||
return FALSE;
|
||||
|
||||
while (threads->doc_id_pos < threads->doc_ids->len) {
|
||||
doc_id = g_array_index (threads->doc_ids, unsigned int,
|
||||
threads->doc_id_pos);
|
||||
|
|
Loading…
Reference in a new issue