Closed
Description
Hello all
My First Bug report i think , so i hope it ok
I am getting an error that 'is
Cannot read property 'hasOwnProperty' of undefined
from Leaflet/src/layer/vector/Path.js line 104
this is the code from path.js
setStyle: function (style) {
Util.setOptions(this, style);
if (this._renderer) {
this._renderer._updateStyle(this);
if (this.options.stroke && style.hasOwnProperty('weight')) {
this._updateBounds();
}
}
return this;
},
it is because style can be undefined. When hasOwnProperty is called on the undefined style it gives an error.
could we do a check on style to make sure it is defined before hasOwnProperty is called?
(this.options.stroke && style && style.hasOwnProperty('weight')
setStyle: function (style) {
Util.setOptions(this, style);
if (this._renderer) {
this._renderer._updateStyle(this);
if (this.options.stroke && style && style.hasOwnProperty('weight')) {
this._updateBounds();
}
}
return this;
},
Best
Ben
Metadata
Assignees
Labels
No labels