From: Thomas Roessler Date: Wed, 10 Dec 2003 00:48:57 +0000 (+0000) Subject: Avoid NULL pointer deference in threading code. X-Git-Tag: mutt-1-5-6-rel~62 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8896cc94635b076d22654576d3b7ba2f01bf942a;p=mutt Avoid NULL pointer deference in threading code. --- diff --git a/thread.c b/thread.c index b26a7878..03409ea4 100644 --- a/thread.c +++ b/thread.c @@ -72,7 +72,7 @@ static int need_display_subject (CONTEXT *ctx, HEADER *hdr) return (1); } } - + /* if we have no visible parent or previous sibling, display the subject */ return (1); } @@ -947,16 +947,19 @@ void mutt_sort_threads (CONTEXT *ctx, int init) if (!option (OPTSTRICTTHREADS)) pseudo_threads (ctx); - ctx->tree = mutt_sort_subthreads (ctx->tree, init); - - /* restore the oldsort order. */ - Sort = oldsort; + if (ctx->tree) + { + ctx->tree = mutt_sort_subthreads (ctx->tree, init); - /* Put the list into an array. */ - linearize_tree (ctx); + /* restore the oldsort order. */ + Sort = oldsort; + + /* Put the list into an array. */ + linearize_tree (ctx); - /* Draw the thread tree. */ - mutt_draw_tree (ctx); + /* Draw the thread tree. */ + mutt_draw_tree (ctx); + } } static HEADER *find_virtual (THREAD *cur, int reverse)