shithub: riscv

Download patch

ref: 6c434774926d3d02becbc726fff37f80bb16029b
parent: 82d04a4e63253cf7d3575d9876d318401e0993c0
author: Ori Bernstein <[email protected]>
date: Mon Oct 28 10:12:44 EDT 2019

Check if 'm' is null when updating messages.

--- a/sys/src/cmd/upas/fs/imap.c
+++ b/sys/src/cmd/upas/fs/imap.c
@@ -355,9 +355,10 @@
 				m->imapuid = v;
 			if(imap->nuid < imap->muid)
 				imap->f[imap->nuid].uid = v;
-		}else if(strcmp(f[i], "flags") == 0)
-			parseflags(m, f[i + 1]);
-		else if(strncmp(f[i], "body[]", 6) == 0){
+		}else if(strcmp(f[i], "flags") == 0){
+			if(m)
+				parseflags(m, f[i + 1]);
+		}else if(strncmp(f[i], "body[]", 6) == 0){
 			s = f[i]+6;
 			o = 0;
 			if(*s == '<')
@@ -562,7 +563,7 @@
 	if(p > buf){
 		p[-1] = 0;
 		imap4cmd(imap, "uid store %lud flags (%s)", (ulong)m->imapuid, buf);
-		imap4resp(imap);
+		imap4resp0(imap, mb, m);
 	}
 }