Module Name:    src
Committed By:   christos
Date:           Fri Dec 17 13:14:54 UTC 2021

Modified Files:
        src/usr.bin/mail: thread.c

Log Message:
more protection from unset threads from RVP


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/mail/thread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/thread.c
diff -u src/usr.bin/mail/thread.c:1.12 src/usr.bin/mail/thread.c:1.13
--- src/usr.bin/mail/thread.c:1.12	Tue Dec 14 16:12:03 2021
+++ src/usr.bin/mail/thread.c	Fri Dec 17 08:14:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: thread.c,v 1.12 2021/12/14 21:12:03 christos Exp $	*/
+/*	$NetBSD: thread.c,v 1.13 2021/12/17 13:14:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #ifndef __lint__
-__RCSID("$NetBSD: thread.c,v 1.12 2021/12/14 21:12:03 christos Exp $");
+__RCSID("$NetBSD: thread.c,v 1.13 2021/12/17 13:14:54 christos Exp $");
 #endif /* not __lint__ */
 
 #include <assert.h>
@@ -594,6 +594,8 @@ first_visible_message(struct message *mp
 
 	if (mp == NULL)
 		mp = current_thread.t_head;
+	if (mp == NULL)
+		return;
 
 	if (mp == NULL)
 		return NULL;
@@ -827,6 +829,9 @@ thread_array(struct key_sort_s *marray, 
 {
 	struct message *parent;
 
+	if (mcount == 0)
+		return;
+
 	parent = marray[0].mp->m_plink;
 	qsort(marray, mcount, sizeof(*marray), qsort_cmpfn);
 	link_array(marray, mcount);

Reply via email to