ref: 63b1407404f050c40ea37025e3bbcc21a69adf03
parent: d97ed15a73c00445fd2e5fadc1228f9ef2dfe559
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Nov 17 14:42:24 EST 2020
rethread: correctly update number of message children
--- a/mbox.c
+++ b/mbox.c
@@ -530,10 +530,13 @@
/* remove child, preserving order */
j = 0;
p = m->parent;
- for(i = 0; p && i < p->nchild; i++){
- if(p->child[i] != m)
- j++;
- p->child[j] = p->child[i];
+ if(p != nil){
+ for(i = 0; p && i < p->nchild; i++){
+ if(p->child[i] != m)
+ j++;
+ p->child[j] = p->child[i];
+ }
+ p->nchild = j;
}
/* reparent children */