shramov / leaflet-plugins

Plugins for Leaflet library
http://psha.org.ru/b/leaflet-plugins.html
MIT License
722 stars 289 forks source link

KML.js bombs out on empty name "<name></name>" #256

Closed mickfrancis closed 7 years ago

mickfrancis commented 7 years ago

There is an issue with empty names when using KML.js: If the KML file contains the following code (around line 210 in my copy) bombs out:

if (el.length) {
    name = el[0].childNodes[0].nodeValue;
}

Suggested fix:

var ch;
if (el.length) {
    ch = el[0].childNodes;
    if (ch && ch.length) {
        name = ch[0].nodeValue;
    }
}

Kind regards,

Mick.

brunob commented 7 years ago

Have you tried with an up to date version of the script ? This seems fix since 49b6022c0ab33d56c1c79acca796220bc7ddb2d9

mickfrancis commented 7 years ago

Hi,

Ah – thanks for this!

Kind regards,

Mick Francis Senior Software Engineer

direct: +44 (0) 1344 350427 mobile: +44 7981 027106 e-mail: mick.francis@lightfootsolutions.com mailto:mick.francis@lightfootsolutions.com%20 web: www.lightfootsolutions.comhttp://www.lightfootsolutions.com

Lightfoot Solutions and signalsfromnoise®(sfn) – Smarter Insights, Connected Thinking

[lightfoot_logo_blue] Lightfoot Solutions UK Limited, Richmond House, Oldbury, Bracknell, Berkshire, RG12 8TQ. Tel: +44 (0) 1344 350400. Fax:+44 (0) 1344 457550. Registered Office No. 06988557

Important Notice This e-mail is confidential, may be legally privileged, and is for the intended recipient only. Access, disclosure, copying, distribution or reliance on any of it by anyone else is prohibited and may be a criminal offence. Please delete or destroy all copies immediately if obtained in error and e-mail confirmation to the sender. Thank you.

From: b_b [mailto:notifications@github.com] Sent: 05 November 2016 09:14 To: shramov/leaflet-plugins Cc: Mick Francis; Author Subject: Re: [shramov/leaflet-plugins] KML.js bombs out on empty name "" (#256)

Have you tried with an up to date version of the script ? This seems fix since 49b6022https://github.com/shramov/leaflet-plugins/commit/49b6022c0ab33d56c1c79acca796220bc7ddb2d9

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/shramov/leaflet-plugins/issues/256#issuecomment-258600076, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AWL00RerF5DcZ_ap-lUv2L84o4bTQ8-xks5q7EjLgaJpZM4Kpndo.