From 57651417f2d0d7263821b397aac624a8c5ac444d Mon Sep 17 00:00:00 2001 From: Mikhaela Tapia <98727316+mxkae@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:02:34 +0800 Subject: [PATCH] fix (map block): fix error when there is no icon provided (#3362) --- src/block/map/deprecated.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/block/map/deprecated.js b/src/block/map/deprecated.js index f14018846..90e9210c9 100644 --- a/src/block/map/deprecated.js +++ b/src/block/map/deprecated.js @@ -14,7 +14,14 @@ import { addFilter } from '@wordpress/hooks' const getIconOptions_3_13_0 = attributes => { const newAttributes = { ...attributes } + if ( ! attributes.icon ) { + return null + } const svgEl = createElementFromHTMLString( attributes.icon ) + + if ( ! svgEl || ! svgEl.firstElementChild ) { + return null + } svgEl.firstElementChild.setAttribute( 'fill', 'currentColor' ) newAttributes.icon = svgEl.outerHTML return getIconOptions( newAttributes )