summaryrefslogtreecommitdiffstats
path: root/thread.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2003-12-10 00:48:57 +0000
committerThomas Roessler <roessler@does-not-exist.org>2003-12-10 00:48:57 +0000
commit8896cc94635b076d22654576d3b7ba2f01bf942a (patch)
treebb050973afdf7be1112d2e034e230a0a07a213a9 /thread.c
parent173056e22474688ca471a78e39a34f0dc9a13fa6 (diff)
Avoid NULL pointer deference in threading code.
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c21
1 files changed, 12 insertions, 9 deletions
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)