From f68631d61c82e9ec3fcd6be9a7a3b6a2695b8e18 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 13 Jan 2014 10:21:30 +0100 Subject: [PATCH] Use goog.asserts.assertInstanceof to check the getSource return type See 1499af397d9852eded193a8b06ea9d8bad71a49f --- src/ol/interaction/drawinteraction.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ol/interaction/drawinteraction.js b/src/ol/interaction/drawinteraction.js index 61593a47e6..0dbc050bd9 100644 --- a/src/ol/interaction/drawinteraction.js +++ b/src/ol/interaction/drawinteraction.js @@ -16,6 +16,7 @@ goog.require('ol.geom.Point'); goog.require('ol.geom.Polygon'); goog.require('ol.interaction.Interaction'); goog.require('ol.render.FeaturesOverlay'); +goog.require('ol.source.Vector'); goog.require('ol.style.Circle'); goog.require('ol.style.Fill'); goog.require('ol.style.Stroke'); @@ -425,7 +426,9 @@ ol.interaction.Draw.prototype.finishDrawing_ = function(event) { } if (!goog.isNull(this.layer_)) { - this.layer_.getSource().addFeature(sketchFeature); + var vectorSource = this.layer_.getSource(); + goog.asserts.assertInstanceof(vectorSource, ol.source.Vector); + vectorSource.addFeature(sketchFeature); } };