X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fnew.c;h=38c8f0b0329799f8642597104217b145e618ae24;hb=025bb212470ef2945c9b7f57cb7fbfceb3e04e2c;hp=41d2ebf8cb6b7fb6ae9e21dac9186cbfae187b88;hpb=5dd6771b28c257af405d7248639ed0e3bcdce38b;p=mmh diff --git a/uip/new.c b/uip/new.c index 41d2ebf..38c8f0b 100644 --- a/uip/new.c +++ b/uip/new.c @@ -218,6 +218,8 @@ crawl_callback(char *folder, void *baton) * `cur' points to the name of the current folder, `folders' points to the * name of a .folder (if NULL, crawl all folders), and `sequences' points to * the array of sequences for which to look. + * + * An empty list is returned as first=last=NULL. */ static void check_folders(struct node **first, struct node **last, @@ -229,7 +231,7 @@ check_folders(struct node **first, struct node **last, char *line; size_t len; - *first = *cur_node = NULL; + *first = *last = *cur_node = NULL; *maxlen = 0; b.first = first; @@ -308,7 +310,10 @@ doit(char *cur, char *folders, char *sequences[]) folders, sequences); if (run_mode == FNEXT || run_mode == FPREV) { - if (first->n_next == NULL) { + if (first == NULL) { + /* No folders at all... */ + return NULL; + } else if (first->n_next == NULL) { /* We have only one node; any desired messages in it? */ if (first->n_field == NULL) { return NULL; @@ -403,6 +408,9 @@ main(int argc, char **argv) char *unseen; struct node *folder; + sequences[0] = NULL; + sequences[1] = NULL; + #ifdef LOCALE setlocale(LC_ALL, ""); #endif @@ -449,6 +457,7 @@ main(int argc, char **argv) /* have a sequence argument */ if (!seq_in_list(cp, sequences)) { sequences[i++] = cp; + sequences[i] = NULL; } }