From c82d5ba88e89d0ce956f325261b00ba55858bcb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Fri, 28 Mar 2014 16:09:52 +0100 Subject: [PATCH] Make the Modify interaction more robust This prevents a JavaScript error when features are added while the interaction does not have a map. --- src/ol/interaction/modifyinteraction.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ol/interaction/modifyinteraction.js b/src/ol/interaction/modifyinteraction.js index f9832ac122..9912e44ea4 100644 --- a/src/ol/interaction/modifyinteraction.js +++ b/src/ol/interaction/modifyinteraction.js @@ -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); + } };