From 10cc10e0e88569cc48d86e9ab4d90538683bfaf6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 2 Sep 2021 20:49:27 -0700 Subject: Handle missing string --- modern/src/map/switcher/switcher.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modern/src') diff --git a/modern/src/map/switcher/switcher.js b/modern/src/map/switcher/switcher.js index cb7326f4..c239662a 100644 --- a/modern/src/map/switcher/switcher.js +++ b/modern/src/map/switcher/switcher.js @@ -29,7 +29,9 @@ export class SwitcherControl { const styleElement = document.createElement('button'); styleElement.type = 'button'; styleElement.innerText = style.title; - styleElement.classList.add(style.title.replace(/[^a-z0-9-]/gi, '_')); + if (style.title) { + styleElement.classList.add(style.title.replace(/[^a-z0-9-]/gi, '_')); + } styleElement.dataset.uri = JSON.stringify(style.uri); styleElement.addEventListener('click', (event) => { const { srcElement } = event; -- cgit v1.2.3