diff --git a/bundles/org.openhab.ui/web/src/components/widgets/layout/oh-canvas-embedded-svg-mixin.js b/bundles/org.openhab.ui/web/src/components/widgets/layout/oh-canvas-embedded-svg-mixin.js index cd47319f23..d40b987a0a 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/layout/oh-canvas-embedded-svg-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/layout/oh-canvas-embedded-svg-mixin.js @@ -76,6 +76,8 @@ export default { * Remember to unsubscribe from the mutations using {@link unsubscribeEmbeddedSvgStateTracking} when the component is destroyed. */ setupEmbeddedSvgStateTracking () { + if (!this.config.embeddedSvgActions) return + const svg = this.$refs.canvasBackground.querySelector('svg') const subElements = svg.querySelectorAll('[openhab]') @@ -146,7 +148,7 @@ export default { if (this.context.editmode || (!this.context.editmode && this.config.embedSvgFlashing)) { const tagName = el.tagName // fill green if item config is available, red if config is still missing - const fillColor = (this.config.embeddedSvgActions[el.id]) ? 'rgb(0, 255, 0)' : 'rgb(255, 0, 0)' + const fillColor = (this.config.embeddedSvgActions && this.config.embeddedSvgActions[el.id]) ? 'rgb(0, 255, 0)' : 'rgb(255, 0, 0)' if (tagName !== 'g' && !el.flashing) { // sometimes instead of fill, stroke colors are used, so if fill = none, then we use stroke instead const attributeName = (el.style.fill !== 'none') ? 'fill' : 'stroke' @@ -190,7 +192,9 @@ export default { if (this.context.editmode) { this.openSvgSettingsPopup(el.id) } else { - this.performAction(null, null, this.config.embeddedSvgActions[el.id], this.context) + if (this.config.embeddedSvgActions && this.config.embeddedSvgActions[el.id]) { + this.performAction(null, null, this.config.embeddedSvgActions[el.id], this.context) + } } }, /**