More robust array type check. p=mwootendev, r=me (closes #2959)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12095 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -219,7 +219,7 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
|
||||
}
|
||||
var geometry, collection = false;
|
||||
if(obj.type == "GeometryCollection") {
|
||||
if(!(obj.geometries instanceof Array)) {
|
||||
if(!(OpenLayers.Util.isArray(obj.geometries))) {
|
||||
throw "GeometryCollection must have geometries array: " + obj;
|
||||
}
|
||||
var numGeom = obj.geometries.length;
|
||||
@@ -232,7 +232,7 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
|
||||
geometry = new OpenLayers.Geometry.Collection(components);
|
||||
collection = true;
|
||||
} else {
|
||||
if(!(obj.coordinates instanceof Array)) {
|
||||
if(!(OpenLayers.Util.isArray(obj.coordinates))) {
|
||||
throw "Geometry must have coordinates array: " + obj;
|
||||
}
|
||||
if(!this.parseCoords[obj.type.toLowerCase()]) {
|
||||
@@ -450,7 +450,7 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
|
||||
var geojson = {
|
||||
"type": null
|
||||
};
|
||||
if(obj instanceof Array) {
|
||||
if(OpenLayers.Util.isArray(obj)) {
|
||||
geojson.type = "FeatureCollection";
|
||||
var numFeatures = obj.length;
|
||||
geojson.features = new Array(numFeatures);
|
||||
|
||||
Reference in New Issue
Block a user