Description
When performing a not null assertion on a person value returned from a getPersonByIdentifier call the application will crash, the second assertion where the person does not exist works fine
You can use
https://github.com/ewanharris/mocha-test to test this, paste the code below and then click the blue label
var window = Ti.UI.createWindow();
// create a person
var lbl = Ti.UI.createLabel({
backgroundColor: 'blue',
width: 400
})
window.add(lbl)
lbl.addEventListener('click', function(e){
var person = Ti.Contacts.createPerson({
firstName: 'Arthur',
lastName: 'Evans'
});
Ti.Contacts.save();
// Query for person we created
var queriedPerson = Ti.Contacts.getPersonByIdentifier(person.identifier);
should(queriedPerson).not.be.null;
should(queriedPerson.firstName).be.eql(person.firstName);
should(queriedPerson.lastName).be.eql(person.lastName);
should(queriedPerson.identifier).be.eql(person.identifier);
// remove the person
Ti.Contacts.removePerson(queriedPerson);
Ti.Contacts.save();
// Make sure they got removed
queriedPerson = Ti.Contacts.getPersonByIdentifier(person.identifier);
should(queriedPerson).be.null;
})
window.open();
Steps to reproduce
Paste the code above into the mocha-test app
Run the app to a Windows target
Tap the blue button
Actual
App crashes
Expected
App should not crash
https://github.com/appcelerator/titanium_mobile_windows/pull/1089
FR Passed
Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.