{ "id": "78808", "key": "TIMOB-4908", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "12076", "description": "Mobile @ HQ Week", "name": "Sprint 2011-36", "archived": true, "released": true, "releaseDate": "2011-09-12" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-09-08T14:51:22.000+0000", "created": "2011-08-05T13:31:17.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "11570", "description": "", "name": "Release 1.7.2", "archived": true, "released": true, "releaseDate": "2011-07-21" } ], "issuelinks": [], "assignee": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-24T18:22:17.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "If you try to reference Ti.Contacts.getPersonByID(); with an ID that is invalid, it crashes the application. Using an if statement or a try/catch still crashes. See example below:\r\n\r\n{code:title=app.js}\r\n\r\nvar win = Titanium.UI.createWindow();\r\n\r\n/*Use to find a valid ID\r\nTi.Contacts.showContacts({\r\n animated: true,\r\n selectedPerson: function(e) {\r\n alert(e.person.recordId);\r\n }\r\n});\r\n*/\r\n\r\np = Ti.Contacts.getPersonByID(3);\r\nalert(p.fullName);\r\n\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "getPersonByID crashes if ID does not exist", "creator": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS Simulator", "comment": { "comments": [ { "id": "163694", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PULL PENDING #405 https://github.com/appcelerator/titanium_mobile/pull/405 ", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-22T17:41:34.000+0000", "updated": "2011-08-22T17:41:34.000+0000" }, { "id": "165021", "author": { "name": "moshebox@gmail.com", "key": "moshebox@gmail.com", "displayName": "Moshe Marciano", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "This fix is fine, but is incomplete.\r\n\r\nthe file ContactPerson.m has a record method of it's own that does not rely on the one fixed in ContactModule.m, therefor, the crash still occurs if you try to use the fullName method on an contactPerson that doesn't exist\r\n\r\n\r\nthis is an excerpt:\r\n\r\nif (record == NULL) {\r\n\t\tif (recordId != kABRecordInvalidID) {\r\n\t\t\trecord = ABAddressBookGetPersonWithRecordID([module addressBook], recordId);\r\n\t\t}", "updateAuthor": { "name": "moshebox@gmail.com", "key": "moshebox@gmail.com", "displayName": "Moshe Marciano", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2011-09-05T02:52:33.000+0000", "updated": "2011-09-05T02:52:33.000+0000" }, { "id": "165418", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "getpersonByID returns a NUll if it doesn't exist. and trying to access a null variable fullname would raise an exception in javascript itself.", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-08T14:50:14.000+0000", "updated": "2011-09-08T14:50:14.000+0000" }, { "id": "165419", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "the correct usage for these methods can be found in KitchenSink.\r\n", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-08T14:51:58.000+0000", "updated": "2011-09-08T14:51:58.000+0000" }, { "id": "166166", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Example of this working correctly can be found in this file from the KS:\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/blob/master/demos/KitchenSink/Resources/examples/contacts_searchById.js", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-09-15T09:55:52.000+0000", "updated": "2011-09-15T09:56:48.000+0000" }, { "id": "415670", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": " Closing ticket as invalid with reference to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-24T18:22:17.000+0000", "updated": "2017-03-24T18:22:17.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }