Skip to content

Commit

Permalink
ignore openPopup if map not initialized, close Leaflet#2343
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Dec 31, 2013
1 parent 7d18adb commit b296535
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion debug/vector/vector-simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
var marker = L.marker([51.5, -0.09])
.bindPopup("<b>Hello world!</b><br />I am a popup.")
.addTo(map);
//.openPopup();

var circle = L.circle([51.508, -0.11], 500, {color: '#f03', opacity: 0.7})
.bindPopup("I am a circle.")
Expand Down
2 changes: 1 addition & 1 deletion src/layer/Layer.Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ L.Layer.include({
},

openPopup: function (latlng) {
if (this._popup) {
if (this._popup && this._map) {
this._map.openPopup(this._popup, latlng || this._latlng || this.getCenter());
}
return this;
Expand Down

0 comments on commit b296535

Please sign in to comment.