aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-show.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2014-01-23 08:24:01 -0400
committerDavid Bremner <david@tethera.net>2014-01-24 20:24:11 -0400
commitecbb29e8cea404faab2ef55b06431942ee329941 (patch)
treebc7ccf665dc7a9d34af486a9bc4c8b9374431f58 /notmuch-show.c
parent29f125212619ebca8621dd2106b412b22e1b6d22 (diff)
notmuch-show: detect NULL pointer returned from notmuch_query_search_threads
We want to return an error status, not 0 or (worse) segfault.
Diffstat (limited to 'notmuch-show.c')
-rw-r--r--notmuch-show.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/notmuch-show.c b/notmuch-show.c
index 528694be..d416fbd5 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -1015,9 +1015,13 @@ do_show (void *ctx,
notmuch_messages_t *messages;
notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
+ threads = notmuch_query_search_threads (query);
+ if (! threads)
+ return 1;
+
sp->begin_list (sp);
- for (threads = notmuch_query_search_threads (query);
+ for ( ;
notmuch_threads_valid (threads);
notmuch_threads_move_to_next (threads))
{