diff --git a/src/controls/legend/imagesource.js b/src/controls/legend/imagesource.js index d24ac2a96..ced102175 100644 --- a/src/controls/legend/imagesource.js +++ b/src/controls/legend/imagesource.js @@ -1,11 +1,9 @@ const getSource = (style) => { - if ('image' in style) { - if (style.image.src) { - return style.image.src; - } - throw new Error('image style must have src'); - } - return null; + const image = style.image || style.custom.image; + if (!image) return null; + const src = image.src || null; + if (!src) throw new Error('image style must have src'); + else return src; }; // return the image source from an origo style