Merge pull request #1918 from snkashis/empty_interior_ring

Throw invalid GeoJSON error on Polygon with an empty interior
This commit is contained in:
Vladimir Agafonkin 2013-07-29 12:17:16 -07:00
commit b313165cca

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);