Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APContact initWithRecordRef:fieldMask:] fails when asked to retrieve non-existent fields #66

Open
austin-bowen-advyon opened this issue May 21, 2015 · 1 comment

Comments

@austin-bowen-advyon
Copy link

If

  1. you have an initiated ABRecordRef (such as that returned by ABPeoplePickerNavigationController),
  2. and you try to generate an APContact instance from the ABRecordRef by using [[APContact alloc] initWithRecordRef:recordRef fieldMask:fieldMask],
  3. and the fieldMask requests an array-type field (such as APContactFieldPhones) that is null / does not exist in the ABRecordRef,

then the program fails.

I believe the APContact should simply set the non-existent fields to a type of null value, if the field does not exist in the ABRecordRef.

@austin-bowen-advyon
Copy link
Author

I think I may have found the solution.

In APContact.m, line 210, a call to CFRelease(multiValue) is called. It is called whether or not multiValue is not null.

I added a new line under line 202:

if (multiValue == NULL) return;

This has fixed the problem for me. I recommend adding NULL checks throughout the rest of the file as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant