summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-06-11 12:08:44 +0200
committerAleksander Machniak <alec@alec.pl>2013-06-11 12:08:44 +0200
commitae80b5a309be69a47b438e2dc1e342735b5e22aa (patch)
tree09b7d8d62b1499d18522891aaca5212df6c76239
parentc6406eb1a9c0ea1f0d523af74fe16bad8f885dc9 (diff)
Fix error when there's no writeable addressbook source (#1489162)
-rw-r--r--CHANGELOG1
-rw-r--r--program/include/rcmail.php5
-rw-r--r--program/steps/mail/show.inc10
3 files changed, 13 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index a4aff5ced..3964a5801 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix error when there's no writeable addressbook source (#1489162)
- Add option show_real_foldernames to disable localization of special folders
- Fix zipdownload plugin issue with filenames charset (#1489156)
- Fix database cache expunge issues (#1489149)
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 22d081130..fd625ba4d 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 d8d4372f9..59f4d55e1 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -275,9 +275,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;