Throw invalid GeoJSON error on Polygon with an empty interior

This commit is contained in:
Steve Kashishian 2013-07-29 14:56:29 -04:00
parent ba7a7f58cb
commit b36a79d386

View File

@ -99,6 +99,9 @@ L.extend(L.GeoJSON, {
return new L.Polyline(latlngs);
case 'Polygon':
if (coords.length === 2 && !coords[1].length) {
throw new Error('Invalid GeoJSON object.');
}
latlngs = this.coordsToLatLngs(coords, 1, coordsToLatLng);
return new L.Polygon(latlngs);