Skip to content
Browse files

Warn about error, if one occurs.

The version_x_results methods will return nil in case of an error. We
need to detect that and not execute that branch of the 'if' statement.
  • Loading branch information...
1 parent 04e6eef commit 16fd4bad182eff66aca5c9d1e1f12458e9b4928b @alexreisner committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/geocoder/lookups/yahoo.rb
View
8 lib/geocoder/lookups/yahoo.rb
@@ -13,10 +13,10 @@ def map_link_url(coordinates)
def results(query)
return [] unless doc = fetch_data(query)
doc = doc['ResultSet']
- if api_version(doc).to_i == 1
- return version_1_results(doc)
- elsif api_version(doc).to_i == 2
- return version_2_results(doc)
+ if api_version(doc).to_i == 1 and r = version_1_results(doc)
+ return r
+ elsif api_version(doc).to_i == 2 and r = version_2_results(doc)
+ return r
else
warn "Yahoo Geocoding API error: #{doc['Error']} (#{doc['ErrorMessage']})."
return []

0 comments on commit 16fd4ba

Please sign in to comment.
Something went wrong with that request. Please try again.