pietern/googlecontacts

No method for Nil when parsing my contacts

Opened this issue · 0 comments

Probably because my contacts have been imported, transformed and beaten about a bit before arriving in google. Never the less here is the trivial patch. Passes spec.

diff --git a/lib/google_contacts/proxies/hash.rb b/lib/google_contacts/proxies/hash.rb
index 41d583a..4c35142 100644
--- a/lib/google_contacts/proxies/hash.rb
+++ b/lib/google_contacts/proxies/hash.rb
@@ -18,7 +18,9 @@ module GoogleContacts

         # create a deep copy
         @new = ::HashWithIndifferentAccess.new
-        @current.each { |k,v| @new[k.dup] = v.dup }
+        @current.each do |k,v|
+          @new[k.dup] = v.dup unless v.nil?
+        end
       end

       def changed?