From acb4b71ce55f3d98f7053b7bb8fdcf3c7858fbfc Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 11 Jun 2013 12:08:44 +0200 Subject: Fix error when there's no writeable addressbook source (#1489162) Conflicts: CHANGELOG --- program/include/rcmail.php | 5 +++++ program/steps/mail/show.inc | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'program') diff --git a/program/include/rcmail.php b/program/include/rcmail.php index c35c24f8c..19a89b84c 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -228,6 +228,11 @@ class rcmail extends rcube } if (!$contacts) { + // there's no default, just return + if ($default) { + return null; + } + self::raise_error(array( 'code' => 700, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index b01989ad8..dbb6d217f 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -255,9 +255,13 @@ function rcmail_contact_exists($email) if ($email) { // @TODO: search in all address books? $CONTACTS = $RCMAIL->get_address_book(-1, true); - $existing = $CONTACTS->search('email', $email, true, false); - if ($existing->count) - return true; + + if (is_object($CONTACTS)) { + $existing = $CONTACTS->search('email', $email, true, false); + if ($existing->count) { + return true; + } + } } return false; -- cgit v1.2.3