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

gmail contacts import breaks if contact has no name or email #121

Closed
koryteg opened this issue Nov 19, 2014 · 3 comments
Closed

gmail contacts import breaks if contact has no name or email #121

koryteg opened this issue Nov 19, 2014 · 3 comments

Comments

@koryteg
Copy link

koryteg commented Nov 19, 2014

I had a contact in gmail that was just a phone number(don't ask me how). but I get this error:
undefined method `[]' for nil:NilClass

block in OmniContacts::Importer::Gmail#contacts_from_response
on line 91:
contact[:first_name], contact[:last_name], contact[:name] = email_to_name(contact[:emails][0][:email]) if contact[:name].nil? && contact[:emails][0][:email]

the error comes from contact[:emails][0][:email] because you cant call [:email] on nil ( because contact[:emails][0] is nil).

@rubytastic
Copy link
Collaborator

Could you please use the source of this repo and not the gem version if not done already? The gem has to be build newly but I cannot do this without Diego giving me more rights.

Perhaps if problem persist you can make pull request, happily to merge in

@rubytastic
Copy link
Collaborator

@koryteg
Some basic validation should fix this but I don't have time.
Can you make a pull request checking if any values are nil?

@rubiety
Copy link
Contributor

rubiety commented Nov 22, 2014

I was running into the same issue and made pull request #122. I think the existing nil check there was just slightly off.

rubytastic added a commit that referenced this issue Nov 22, 2014
Add nil check to prevent blowing up when a contact has no e-mails in gmail [Issue #121]
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

3 participants