Skip to content

Commit

Permalink
Merge pull request #34 from Mmontsheng/master
Browse files Browse the repository at this point in the history
Undefined or null check on child nodes value
  • Loading branch information
mdorda committed Oct 6, 2021
2 parents d603d3d + e936905 commit 216223e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion L.KML.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ L.Util.extend(L.KML, {
options[e.attributes[j].name] = e.attributes[j].nodeValue;
}
} else {
var value = e.childNodes[0].nodeValue;
var value = (e.childNodes && e.childNodes.length) ? e.childNodes[0].nodeValue : null;
if(!value) {
continue;
}
if (key === 'color') {
options.opacity = parseInt(value.substring(0, 2), 16) / 255.0;
options.color = '#' + value.substring(6, 8) + value.substring(4, 6) + value.substring(2, 4);
Expand Down

0 comments on commit 216223e

Please sign in to comment.