From 7c7121d1eab2805e1dc3075a08d03b8340c639f4 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Sat, 12 Jan 2013 18:09:01 -0500 Subject: [PATCH] Flash message for no geocoder results --- js/id/ui/geocoder.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/id/ui/geocoder.js b/js/id/ui/geocoder.js index a744f92b2..b3372b899 100644 --- a/js/id/ui/geocoder.js +++ b/js/id/ui/geocoder.js @@ -10,6 +10,11 @@ iD.geocoder = function() { encodeURIComponent(this.value) + '.json', function(err, resp) { if (err) return hide(); hide(); + if (!resp.results.length) { + return iD.flash() + .select('.content') + .text('No location found for "' + resp.query[0] + '"'); + } map.center([resp.results[0][0].lon, resp.results[0][0].lat]); }); }