From 8c3450e46e5b9a0718be8ceed4a2bffa613b25f5 Mon Sep 17 00:00:00 2001 From: mxkae Date: Wed, 30 Oct 2024 19:35:06 +0800 Subject: [PATCH] add null check --- 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 )