Skip to content
Snippets Groups Projects
Commit e9cd55cb authored by Alex Reisner's avatar Alex Reisner
Browse files

Merge pull request #157 from JustinLove/master

Ensure all do_lookup blocks have empty list protection
parents 0e157f67 b637884b
No related branches found
No related tags found
No related merge requests found
......@@ -266,11 +266,12 @@ module Geocoder::Store
#
def reverse_geocode
do_lookup(true) do |o,rs|
r = rs.first
unless r.address.nil?
o.send :write_attribute, self.class.geocoder_options[:fetched_address], r.address
if r = rs.first
unless r.address.nil?
o.send :write_attribute, self.class.geocoder_options[:fetched_address], r.address
end
r.address
end
r.address
end
end
......
......@@ -71,11 +71,12 @@ module Geocoder::Store
#
def reverse_geocode
do_lookup(true) do |o,rs|
r = rs.first
unless r.address.nil?
o.send :write_attribute, self.class.geocoder_options[:fetched_address], r.address
if r = rs.first
unless r.address.nil?
o.send :write_attribute, self.class.geocoder_options[:fetched_address], r.address
end
r.address
end
r.address
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment