summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-11-23 19:26:11 +0000
committeralecpl <alec@alec.pl>2010-11-23 19:26:11 +0000
commit617623fa79317c0ada53a217d8908c2deda9a04a (patch)
tree89caeee3fc4926aea2c75e127bf81e98913f0b44
parent1f052f0be2b6e4b2db89a70eca62cd6d21f56878 (diff)
- Fix PHP warning: check if array isn't empty before using max()
-rw-r--r--program/include/rcube_imap.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 7becb4fce..468d98c40 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -693,7 +693,8 @@ class rcube_imap
$result = array(
'count' => count($this->icache['threads']['tree']),
'msgcount' => count($this->icache['threads']['depth']),
- 'maxuid' => max(array_keys($this->icache['threads']['depth'])),
+ 'maxuid' => !empty($this->icache['threads']['depth']) ?
+ max(array_keys($this->icache['threads']['depth'])) : 0,
);
}
else if (is_array($result = $this->_fetch_threads($mailbox))) {
@@ -702,7 +703,7 @@ class rcube_imap
$result = array(
'count' => count($result[0]),
'msgcount' => count($result[1]),
- 'maxuid' => max(array_keys($result[1])),
+ 'maxuid' => !empty($result[1]) ? max(array_keys($result[1])) : 0,
);
}