geo module: don't fail for undefined county names

This commit is contained in:
rlx 2012-03-26 11:07:57 +00:00
parent d25d5f9ced
commit 511c355223

View file

@ -150,7 +150,7 @@ Ox.load.Geo = function(options, callback) {
Ox.getCountryByGeoname = function(geoname) {
// fixme: UAE correction doesn't belong here, fix in map
geoname = geoname.replace(' - United Arab Emirates', ', United Arab Emirates')
geoname = (geoname || '').replace(' - United Arab Emirates', ', United Arab Emirates')
return Ox.getCountryByName(
geoname.split(', ').pop()
.replace('Sint Eustatius and Saba', 'Bonaire, Sint Eustatius and Saba')