Fixed empty Polygon constructor issue

This commit is contained in:
mourner 2011-12-16 14:16:18 +02:00
parent cf8e0ca50e
commit 50a5790072
2 changed files with 2 additions and 1 deletions

View File

@ -68,6 +68,7 @@ Leaflet Changelog
* Fixed broken popup `closePopup` option (by [@jgerigmeyer](https://github.com/jgerigmeyer)).
* Fixed a bug that caused en error when dragging marker with icon without shadow (by [@anru](https://github.com/anru)). [#178](https://github.com/CloudMade/Leaflet/issues/178)
* Fixed a typo in `Bounds` `contains` method (by [@anru](https://github.com/anru)). [#180](https://github.com/CloudMade/Leaflet/pull/180)
* Fixed a bug where creating an empty `Polygon` with `new L.Polygon()` would raise an error.
* Fixed a bug where drag event fired before the actual movement of layer (by [@anru](https://github.com/anru)). [#197](https://github.com/CloudMade/Leaflet/pull/197)
* Fixed a bug where map click caused an error if dragging is initially disabled. [#196](https://github.com/CloudMade/Leaflet/issues/196)
* Fixed a bug where map `movestart` event would fire after zoom animation.

View File

@ -10,7 +10,7 @@ L.Polygon = L.Polyline.extend({
initialize: function (latlngs, options) {
L.Polyline.prototype.initialize.call(this, latlngs, options);
if (latlngs[0] instanceof Array) {
if (latlngs && (latlngs[0] instanceof Array)) {
this._latlngs = latlngs[0];
this._holes = latlngs.slice(1);
}