check if object is returned.
[squirrelmail.git] / functions / abook_ldap_server.php
index 3e1151775192312bf09e44c801faec2436c5d9b3..cfb36000e820916309927db1003643bbb681a0da 100644 (file)
@@ -161,7 +161,7 @@ class abook_ldap_server extends addressbook_backend {
 
         $this->linkid = @ldap_connect($this->server, $this->port);
         if(!$this->linkid) {
-            if(function_exists('ldap_error')) {
+            if(function_exists('ldap_error') && is_object($this->linkid)) {
                 return $this->set_error(ldap_error($this->linkid));
             } else {
                 return $this->set_error('ldap_connect failed');