loleaflet: avoid Uncaught TypeError: Cannot read property

Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
This commit is contained in:
Henry Castro 2016-07-22 20:36:45 -04:00
parent b9fbc6d369
commit fa02df7ad3

View file

@ -833,7 +833,7 @@ map.on('commandstatechanged', function (e) {
// For writer we get UI names; ideally we should be getting only programmatic ones
// For eg: 'Text body' vs 'Text Body'
// (likely to be fixed in core to make the pattern consistent)
if (value.toLowerCase() === state.toLowerCase()) {
if (state && value.toLowerCase() === state.toLowerCase()) {
state = value;
found = true;
return;