Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25013] Windows: Asserting the value returned from getPersonByIdentifier crashes an application

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-11-17T18:22:54.000+0000
Affected Version/sRelease 7.0.0
Fix Version/sRelease 7.0.0
ComponentsWindows
Labelsfailure-reviewed
ReporterEwan Harris
AssigneeKota Iguchi
Created2017-07-24T10:53:34.000+0000
Updated2018-08-06T17:49:35.000+0000

Description

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

Comments

  1. Kota Iguchi 2017-09-01

    https://github.com/appcelerator/titanium_mobile_windows/pull/1089
  2. Josh Longton 2017-11-17

    FR Passed
  3. Eric Merriman 2018-08-06

    Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.

JSON Source