lib: make notmuch_threads_valid return FALSE when passed NULL
[notmuch] / lib / query.cc
index ec60e2e45c01226a9ed326b8af22f1add8b77c8b..60ff8bd9a39e1707e12a4e96cff99890b00d669b 100644 (file)
@@ -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);