From 470790b8114a162dd632071345790231180a1be4 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 10 Mar 2014 15:05:09 +0100 Subject: [PATCH] Check arguments passed to ol.geom.MultiPolygon#setFlatCoordinates --- src/ol/geom/multipolygon.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ol/geom/multipolygon.js b/src/ol/geom/multipolygon.js index 214398858a..8c5b4cd885 100644 --- a/src/ol/geom/multipolygon.js +++ b/src/ol/geom/multipolygon.js @@ -274,6 +274,14 @@ ol.geom.MultiPolygon.prototype.setCoordinates = */ ol.geom.MultiPolygon.prototype.setFlatCoordinates = function(layout, flatCoordinates, endss) { + goog.asserts.assert(!goog.isNull(endss)); + if (goog.isNull(flatCoordinates) || flatCoordinates.length === 0) { + goog.asserts.assert(endss.length === 0); + } else { + goog.asserts.assert(endss.length > 0); + var ends = endss[endss.length - 1]; + goog.asserts.assert(flatCoordinates.length == ends[ends.length - 1]); + } this.setFlatCoordinatesInternal(layout, flatCoordinates); this.endss_ = endss; this.dispatchChangeEvent();