diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-18 20:39:04 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-18 20:39:04 +0200 |
commit | 129b1aa4bd5f7e8b760be5685654f5886c8cfe5f (patch) | |
tree | ab7a3f07792ba2d95488ac33b824db2829c5bd11 /js | |
parent | c5a82804a62a8eaf968d896a640fb02537383d55 (diff) |
Don't fall apart in case we receive an invalid vcard - refs #311 and others
Diffstat (limited to 'js')
-rw-r--r-- | js/services/contact_service.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/js/services/contact_service.js b/js/services/contact_service.js index a00cc262..99aaffca 100644 --- a/js/services/contact_service.js +++ b/js/services/contact_service.js @@ -32,8 +32,13 @@ angular.module('contactsApp') promises.push( AddressBookService.sync(addressBook).then(function (addressBook) { for (var i in addressBook.objects) { - var contact = new Contact(addressBook, addressBook.objects[i]); - contacts.put(contact.uid(), contact); + if (addressBook.objects[i].addressData) { + var contact = new Contact(addressBook, addressBook.objects[i]); + contacts.put(contact.uid(), contact); + } else { + // custom console + console.log('Invalid contact received: ' + addressBook.objects[i].url); + } } }) ); |