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

Improve error handling when geocoder unavailable.

parent dc984540
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,11 @@ module Geocoder
data = self.search(query)
# Make sure search found a result.
return nil unless data['kml']['response']['status']['code'] == "200"
unless data and data['kml']['response']['status']['code'] == "200"
return nil
end
# Isolate the relevant part of the result.
place = data['kml']['response']['placemark']
# If there are multiple results, blindly use the first.
......
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