1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Fix bug oc-413: PHP fatal error in contacts page when no contacts in ownCloud.

This commit is contained in:
Thomas Tanghus 2012-04-07 16:01:50 +02:00
parent f84c53f9a9
commit 5171717382

View 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.'));
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();
}
$cards = array();
foreach($vccontacts as $vccontact) {
$cards[] = $vccontact['carddata'];
}
OC_Contacts_App::$categories->rescan($cards);
$categories = OC_Contacts_App::$categories->categories();
}
}