Improved error handling.
This commit is contained in:
parent
07b9df06fa
commit
62e1a5ecb0
1 changed files with 4 additions and 0 deletions
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue