]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix bug oc-413: PHP fatal error in contacts page when no contacts in ownCloud.
authorThomas Tanghus <thomas@tanghus.net>
Sat, 7 Apr 2012 14:01:50 +0000 (16:01 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Sat, 7 Apr 2012 14:03:43 +0000 (16:03 +0200)
apps/contacts/index.php

index 076b10c2ee21d400936e7fd207020dd56d45a215..776c57ca60542b5fd56de0562204320e125b8b6f 100644 (file)
@@ -43,17 +43,15 @@ if(count($categories) == 0) {
                        $vcaddressbookids[] = $vcaddressbook['id'];
                } 
                $vccontacts = OC_Contacts_VCard::all($vcaddressbookids);
-               if(count($vccontacts) == 0) {
-                       bailOut(OC_Contacts_App::$l10n->t('No contacts found.'));
-               }
-
-               $cards = array();
-               foreach($vccontacts as $vccontact) {
-                       $cards[] = $vccontact['carddata'];
-               } 
+               if(count($vccontacts) > 0) {
+                       $cards = array();
+                       foreach($vccontacts as $vccontact) {
+                               $cards[] = $vccontact['carddata'];
+                       } 
 
-               OC_Contacts_App::$categories->rescan($cards);
-               $categories = OC_Contacts_App::$categories->categories();
+                       OC_Contacts_App::$categories->rescan($cards);
+                       $categories = OC_Contacts_App::$categories->categories();
+               }
        }
 }