diff --git a/modules/ui/general.js b/modules/ui/general.js index 26876188..8d5fc28e 100644 --- a/modules/ui/general.js +++ b/modules/ui/general.js @@ -161,12 +161,14 @@ function showMapTooltip(point, e, i, g) { if (group === "terrain") return tip("Click to edit the Relief Icon"); if (subgroup === "burgLabels" || subgroup === "burgIcons") { - const burg = +path[path.length - 10].dataset.id; - const b = pack.burgs[burg]; - const population = si(b.population * populationRate * urbanization); - tip(`${b.name}. Population: ${population}. Click to edit`); - if (burgsOverview?.offsetParent) highlightEditorLine(burgsOverview, burg, 5000); - return; + const burgId = +path[path.length - 10].dataset.id; + if (burgId) { + const burg = pack.burgs[burgId]; + const population = si(burg.population * populationRate * urbanization); + tip(`${burg.name}. Population: ${population}. Click to edit`); + if (burgsOverview?.offsetParent) highlightEditorLine(burgsOverview, burgId, 5000); + return; + } } if (group === "labels") return tip("Click to edit the Label");