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

Fix bug: nil result on Freegeoip bad response.

In certain conditions a lookup returned [nil] instead of [], which
caused a Result object to be initialized with no data.
parent 10edb1a2
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ module Geocoder::Lookup
# don't look up a loopback address, just return the stored result
return [reserved_result(query)] if loopback_address?(query)
begin
return [fetch_data(query, reverse)]
return (doc = fetch_data(query, reverse)) ? [doc] : []
rescue StandardError # Freegeoip.net returns HTML on bad request
return []
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