[Pkg-javascript-commits] [leaflet] 24/301: Throw invalid GeoJSON error on Polygon with an empty interior

Jonas Smedegaard js at moszumanska.debian.org
Mon Jan 27 22:22:39 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet.

commit b36a79d3867e69019587f09669b87debfb7abc4b
Author: Steve Kashishian <steve at snkashis.com>
Date:   Mon Jul 29 14:56:29 2013 -0400

    Throw invalid GeoJSON error on Polygon with an empty interior
---
 src/layer/GeoJSON.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/layer/GeoJSON.js b/src/layer/GeoJSON.js
index 67f9277..290665d 100644
--- a/src/layer/GeoJSON.js
+++ b/src/layer/GeoJSON.js
@@ -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);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet.git



More information about the Pkg-javascript-commits mailing list