Make the Modify interaction more robust

This prevents a JavaScript error when features are added while the interaction does not have a map.
This commit is contained in:
Éric Lemoine
2014-03-28 16:09:52 +01:00
parent afa5f35cef
commit c82d5ba88e

View File

@@ -156,7 +156,10 @@ ol.interaction.Modify.prototype.addFeature_ = function(evt) {
if (goog.isDef(this.SEGMENT_WRITERS_[geometry.getType()])) {
this.SEGMENT_WRITERS_[geometry.getType()].call(this, feature, geometry);
}
this.handlePointerAtPixel_(this.lastPixel_, this.getMap());
var map = this.getMap();
if (!goog.isNull(map)) {
this.handlePointerAtPixel_(this.lastPixel_, map);
}
};