shithub: Nail

Download patch

ref: c5d8bcc3b4072c9de6c6a156cdbf007e1c27d40f
parent: a3f1beaff67872492d2612c60626d0d85033141a
author: Ori Bernstein <[email protected]>
date: Thu Dec 31 00:24:40 EST 2020

mbox: remove child from correct index

when deleting messages, we were incrementing the
deletion index too early, which would clear the
wrong child when reparenting.

--- a/mbox.c
+++ b/mbox.c
@@ -660,10 +660,9 @@
 	if(p != nil){
 		for(i = 0; p && i < p->nchild; i++){
 			if(p->child[i] != m)
-				j++;
-			p->child[j] = p->child[i];
+				p->child[j++] = p->child[i];
 		}
-		p->nchild--;
+		p->nchild = j;
 		for(pp = p; pp != nil; pp = pp->parent)
 			pp->nsub--;
 	}