summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--program/steps/mail/list.inc5
1 files changed, 2 insertions, 3 deletions
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index d32e93996..8ba0dd017 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -57,11 +57,10 @@ if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL')
// fetch message headers
-if ($IMAP->messagecount($mbox_name, 'ALL', !empty($_REQUEST['_refresh'])))
+if ($count = $IMAP->messagecount($mbox_name, 'ALL', !empty($_REQUEST['_refresh'])))
$a_headers = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order);
-$count = $IMAP->messagecount($mbox_name);
-$unseen = $IMAP->messagecount($mbox_name, 'UNSEEN', !empty($_REQUEST['_refresh']));
+$unseen = $count ? $IMAP->messagecount($mbox_name, 'UNSEEN', !empty($_REQUEST['_refresh'])) : 0;
// update message count display
$pages = ceil($count/$IMAP->page_size);