- Fix PHP warning: check if array isn't empty before using max()

release-0.6
alecpl 14 years ago
parent 1f052f0be2
commit 617623fa79

@ -693,7 +693,8 @@ class rcube_imap
$result = array( $result = array(
'count' => count($this->icache['threads']['tree']), 'count' => count($this->icache['threads']['tree']),
'msgcount' => count($this->icache['threads']['depth']), '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))) { else if (is_array($result = $this->_fetch_threads($mailbox))) {
@ -702,7 +703,7 @@ class rcube_imap
$result = array( $result = array(
'count' => count($result[0]), 'count' => count($result[0]),
'msgcount' => count($result[1]), 'msgcount' => count($result[1]),
'maxuid' => max(array_keys($result[1])), 'maxuid' => !empty($result[1]) ? max(array_keys($result[1])) : 0,
); );
} }

Loading…
Cancel
Save