Improved error handling.

This commit is contained in:
Martin Edenhofer 2014-06-01 10:31:28 +02:00
parent 07b9df06fa
commit 62e1a5ecb0

View file

@ -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]