geometry-less vector features aren't cloneable, r=pspencer (closes #1557)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7252 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2008-05-22 13:42:23 +00:00
parent 069a72b5e7
commit 7f8c5d0c13
2 changed files with 11 additions and 5 deletions

View File

@@ -80,7 +80,7 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
OpenLayers.Feature.prototype.initialize.apply(this,
[null, null, attributes]);
this.lonlat = null;
this.geometry = geometry;
this.geometry = geometry ? geometry : null;
this.state = null;
this.attributes = {};
if (attributes) {
@@ -113,9 +113,10 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
* {<OpenLayers.Feature.Vector>} An exact clone of this vector feature.
*/
clone: function () {
return new OpenLayers.Feature.Vector(this.geometry.clone(),
this.attributes,
this.style);
return new OpenLayers.Feature.Vector(
this.geometry ? this.geometry.clone() : null,
this.attributes,
this.style);
},
/**