fix: prevent ReferenceError when loading maps before style.js loads

Check if heightmapColorSchemes is defined before accessing it to
prevent race condition between load.js and style.js initialization.
This commit is contained in:
Claude 2025-11-14 03:10:05 +00:00
parent 428349f6fb
commit 8d7a1635f9
No known key found for this signature in database

View file

@ -477,7 +477,7 @@ async function parseLoadedData(data, mapVersion) {
}
// add custom heightmap color scheme if any
if (heightmapColorSchemes) {
if (typeof heightmapColorSchemes !== "undefined" && heightmapColorSchemes) {
const oceanScheme = byId("oceanHeights")?.getAttribute("scheme");
if (oceanScheme && !(oceanScheme in heightmapColorSchemes)) addCustomColorScheme(oceanScheme);
const landScheme = byId("#landHeights")?.getAttribute("scheme");