tFix when empty argvs are given. - rohrpost - A commandline mail client to change the world as we see it.
 (HTM) git clone git://r-36.net/rohrpost
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit d3afd5f50c6beed1b99023ab2d100f3755d4af89
 (DIR) parent feb2c2261057045fb36ba1ba1d15a07482d027d9
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Mon,  8 Sep 2014 11:12:26 +0200
       
       Fix when empty argvs are given.
       
       Diffstat:
         imap.c                              |      10 ++++++++--
       
       1 file changed, 8 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/imap.c b/imap.c
       t@@ -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;