From acb4b71ce55f3d98f7053b7bb8fdcf3c7858fbfc Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 11 Jun 2013 06:10:10 -0400
Subject: [PATCH] Fix error when there's no writeable addressbook source (#1489162)

---
 program/steps/mail/show.inc |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index b01989a..dbb6d21 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -255,9 +255,13 @@
   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;

--
Gitblit v1.9.1