From 314b04df7ab29cd68d34fba66289427d3f18bc81 Mon Sep 17 00:00:00 2001 From: geonux Date: Mon, 6 Jul 2015 13:49:42 +0200 Subject: [PATCH] Add assertions to pass the validation step. --- src/ol/interaction/drawinteraction.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ol/interaction/drawinteraction.js b/src/ol/interaction/drawinteraction.js index 7c1729feb4..7b9c950664 100644 --- a/src/ol/interaction/drawinteraction.js +++ b/src/ol/interaction/drawinteraction.js @@ -623,6 +623,8 @@ ol.interaction.Draw.prototype.addToDrawing_ = function(event) { */ ol.interaction.Draw.prototype.removeLastPoint = function() { var geometry = this.sketchFeature_.getGeometry(); + goog.asserts.assertInstanceof(geometry, ol.geom.SimpleGeometry, + 'geometry must be an ol.geom.SimpleGeometry'); var coordinates, sketchLineGeom; if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) { coordinates = this.sketchCoords_; @@ -632,6 +634,8 @@ ol.interaction.Draw.prototype.removeLastPoint = function() { coordinates = this.sketchCoords_[0]; coordinates.splice(-2, 1); sketchLineGeom = this.sketchLine_.getGeometry(); + goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString, + 'sketchLineGeom must be an ol.geom.LineString'); sketchLineGeom.setCoordinates(coordinates); this.geometryFunction_(this.sketchCoords_, geometry); }