* -- as fnext, move to next folder with unseen messages
* -- as fprev, move to previous folder with unseen messages
* -- as unseen, scan all unseen messages
- * $Id$
- *
* This code is Copyright (c) 2008, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
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;