diff --git a/src/services/map-service.js b/src/services/map-service.js index 44ed8290b26084282c8a4cc5908f0ac8f982c047..87156fe6e52733ddd58cc98706b0da17067e0666 100644 --- a/src/services/map-service.js +++ b/src/services/map-service.js @@ -335,13 +335,19 @@ const mapService = { if (colors_style && colors_style.custom_field_name && customfield_set) { const fieldType = customfield_set.find((el) => el.name === colors_style.custom_field_name).field_type; const currentValue = properties[colors_style.custom_field_name]; - if (fieldType === 'list') { - color = colors_style.colors[currentValue]; - opacity = colors_style.opacities[currentValue]; - } else if (fieldType === 'char') { //* if the custom field is supposed to be a string - //* check if its current value is empty or not, to select a color | https://redmine.neogeo.fr/issues/14048 - color = colors_style.value.colors[currentValue ? 'Non vide' : 'Vide']; - opacity = colors_style.value.opacities[currentValue ? 'Non vide' : 'Vide']; + + if (currentValue) { + switch (fieldType) { + case 'list' : + color = colors_style.colors[currentValue]; + opacity = colors_style.opacities[currentValue]; + break; + case 'char': //* if the custom field is supposed to be a string + //* check if its current value is empty or not, to select a color | https://redmine.neogeo.fr/issues/14048 + color = colors_style.value.colors[currentValue ? 'Non vide' : 'Vide']; + opacity = colors_style.value.opacities[currentValue ? 'Non vide' : 'Vide']; + break; + } } } return { color, opacity };