commit d3afd5f50c6beed1b99023ab2d100f3755d4af89
parent feb2c2261057045fb36ba1ba1d15a07482d027d9
Author: Christoph Lohmann <20h@r-36.net>
Date: Mon, 8 Sep 2014 11:12:26 +0200
Fix when empty argvs are given.
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/imap.c b/imap.c
@@ -236,14 +236,20 @@ imap_argv2ids(char *cfgn, char *mailbox, int argc, char *argv[])
llist = llist_new();
forllist(allist, argelem) {
+ if (argelem->data == NULL)
+ continue;
nids = llist_splitstr(argelem->key, " ,");
- if (nids != NULL)
+ if (nids != NULL && nids->len > 0)
llist_listadd(llist, nids);
llist_free(nids);
}
llist_free(allist);
- ids = imap_llist2ids(cfgn, mailbox, llist);
+ if (llist->len > 0) {
+ ids = imap_llist2ids(cfgn, mailbox, llist);
+ } else {
+ ids = NULL;
+ }
llist_free(llist);
return ids;