Skip to content

Commit 5765141

Browse files
authored
fix (map block): fix error when there is no icon provided (#3362)
1 parent d4f76c7 commit 5765141

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/block/map/deprecated.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ import { addFilter } from '@wordpress/hooks'
1414

1515
const getIconOptions_3_13_0 = attributes => {
1616
const newAttributes = { ...attributes }
17+
if ( ! attributes.icon ) {
18+
return null
19+
}
1720
const svgEl = createElementFromHTMLString( attributes.icon )
21+
22+
if ( ! svgEl || ! svgEl.firstElementChild ) {
23+
return null
24+
}
1825
svgEl.firstElementChild.setAttribute( 'fill', 'currentColor' )
1926
newAttributes.icon = svgEl.outerHTML
2027
return getIconOptions( newAttributes )

0 commit comments

Comments
 (0)