diff --git a/packages/format-library/src/link/use-link-instance-key.js b/packages/format-library/src/link/use-link-instance-key.js index 7f16a83554446b..5d491a091436e2 100644 --- a/packages/format-library/src/link/use-link-instance-key.js +++ b/packages/format-library/src/link/use-link-instance-key.js @@ -17,6 +17,9 @@ function getKey( _id ) { * @return {string} the unique key to use for this link control. */ function useLinkInstanceKey( instance ) { + if ( ! instance ) { + return; + } if ( weakMap.has( instance ) ) { return getKey( weakMap.get( instance ) ); }