From: Tom Hughes Date: Thu, 13 May 2010 14:32:46 +0000 (+0100) Subject: Ignore unknown countries when doing geolocation X-Git-Tag: live~6331^2~4 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/6ca26591df5989c435b12c26222cba15d9233078 Ignore unknown countries when doing geolocation --- diff --git a/lib/osm.rb b/lib/osm.rb index c92655aee..704bc099c 100644 --- a/lib/osm.rb +++ b/lib/osm.rb @@ -471,9 +471,7 @@ module OSM def self.IPLocation(ip_address) code = OSM.IPToCountry(ip_address) - unless code.nil? - country = Country.find_by_code(code) - + if code and country = Country.find_by_code(code) return { :minlon => country.min_lon, :minlat => country.min_lat, :maxlon => country.max_lon, :maxlat => country.max_lat } end