diff --git a/packages/block-library/src/list/utils.js b/packages/block-library/src/list/utils.js index 61d1cbef89234..481ec3b6accd9 100644 --- a/packages/block-library/src/list/utils.js +++ b/packages/block-library/src/list/utils.js @@ -30,7 +30,7 @@ export function createListBlockFromDOMElement( listElement ) { const [ nestedList, ...nodes ] = children; const hasNestedList = - nestedList.tagName === 'UL' || nestedList.tagName === 'OL'; + nestedList?.tagName === 'UL' || nestedList?.tagName === 'OL'; if ( ! hasNestedList ) { return createBlock( 'core/list-item', { content: listItem.innerHTML, diff --git a/test/e2e/specs/editor/blocks/__snapshots__/List-can-be-created-by-pasting-an-empty-list-1-chromium.txt b/test/e2e/specs/editor/blocks/__snapshots__/List-can-be-created-by-pasting-an-empty-list-1-chromium.txt new file mode 100644 index 0000000000000..a947833fba19d --- /dev/null +++ b/test/e2e/specs/editor/blocks/__snapshots__/List-can-be-created-by-pasting-an-empty-list-1-chromium.txt @@ -0,0 +1,5 @@ + +