[
https://issues.apache.org/jira/browse/CB-5769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13868184#comment-13868184
]
Abe S commented on CB-5769:
---------------------------
Also, I tried wrapping this with try/catch but that doesn't seem to catch it (I
guess it's not a JS exception...). Is there any way for me to at least handle
it gracefully?
> Contact Find crashes if contact has no name
> -------------------------------------------
>
> Key: CB-5769
> URL: https://issues.apache.org/jira/browse/CB-5769
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin Contacts
> Affects Versions: 3.0.0
> Environment: Nexus 4, android 4.4, phonegap build
> Reporter: Abe S
>
> There seems to be a bug in the contacts finder, it crashes when a contact has
> no name, and name is one of the selected fields.
> Here is what my function call looks like:
> {code}
> navigator.contacts.find( ["name", "phoneNumbers"],
> function (contacts) {
> // DO STUFF HERE
> },
> function (contactError) {
> alert('There was an error loading contacts, please try again.');
> },
> {
> filter: "",
> multiple: true,
> }
> );
> {code}
> And when there is one contact on the device with no name it crashes with this
> stacktrace:
> {noformat}
> processMessage failed: Error: TypeError: Cannot read property 'formatted' of
> null
> processMessage failed: Stack: TypeError: Cannot read property 'formatted' of
> null
> at Object.eval (eval at <anonymous>
> (http://debug.build.phonegap.com/target/target-script-min.js:2340:26),
> <anonymous>:18:65)
> at Function.b.extend.each
> (file:///android_asset/www/js/jquery-1.9.1.min.js:3:5257)
> at navigator.contacts.find.filter (eval at <anonymous>
> (http://debug.build.phonegap.com/target/target-script-min.js:2340:26),
> <anonymous>:15:12)
> at Function.b.extend.each
> (file:///android_asset/www/js/jquery-1.9.1.min.js:3:5257)
> at navigator.contacts.find.filter (eval at <anonymous>
> (http://debug.build.phonegap.com/target/target-script-min.js:2340:26),
> <anonymous>:12:9)
> at win
> (file:///android_asset/www/plugins/org.apache.cordova.contacts/www/contacts.js:51:17)
> at Object.cordova.callbackFromNative
> (file:///android_asset/www/cordova.js:307:54)
> at processMessage (file:///android_asset/www/cordova.js:1029:21)
> at Function.androidExec.processMessages
> (file:///android_asset/www/cordova.js:1063:13)
> at pollOnce (file:///android_asset/www/cordova.js:933:17)
> {noformat}
> Of course, when I add a name to that contact, it no longer crashes.
> This is experienced on phonegpa 3.0, on phonegap build, so it might be
> already fixed in later versions of phonegap, but that could easily be tested
> by anyone using those later versions.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)