From 90ff8269cf5999dd605cb71a51251846e3354efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= Date: Fri, 27 Jul 2018 10:20:28 +0200 Subject: [PATCH] Bail early if no proper block --- editor/store/selectors.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/store/selectors.js b/editor/store/selectors.js index 6e498ca1c31a6..aad87a7b02705 100644 --- a/editor/store/selectors.js +++ b/editor/store/selectors.js @@ -576,6 +576,10 @@ export const getBlocks = createSelector( * @return {Array} ids of referenced and inner blocks. */ const unfoldClientIds = ( state, block ) => { + if ( ! block ) { + return [ null ]; + } + const getClientIdsFromSharedBlock = ( globalState, sharedBlock ) => { if ( sharedBlock.name === 'core/block' ) { const clientId = get( getSharedBlock( globalState, sharedBlock.attributes.ref ), [ 'clientId' ], null ); @@ -587,7 +591,7 @@ const unfoldClientIds = ( state, block ) => { return [ null ]; }; const getClientIdsFromInnerBlock = ( globalState ) => ( innerBlock ) => [ - innerBlock.clientId, + get( innerBlock, [ 'clientId' ], null ), ...unfoldClientIds( globalState, innerBlock ), ]; return [