diff --git a/lib/geo_location/gmaps.rb b/lib/geo_location/gmaps.rb index c286c9820..4d09f3f81 100644 --- a/lib/geo_location/gmaps.rb +++ b/lib/geo_location/gmaps.rb @@ -9,6 +9,10 @@ class GeoLocation::Gmaps result = JSON.parse( response.body ) + return if !result + return if !result['results'] + return if !result['results'].first + lat = result['results'].first['geometry']['location']['lat'] lng = result['results'].first['geometry']['location']['lng'] latlng = [lat,lng]