From 13e48433ab763555a59af8ceab8be9f03eb06eb3 Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 17 Nov 2021 23:08:42 +0100 Subject: [PATCH] Check if maxwidth exists before trying to call .length (#21785) --- .../jetpack/changelog/fix-videopress-block-gutenberg-error | 4 ++++ projects/plugins/jetpack/extensions/blocks/videopress/save.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 projects/plugins/jetpack/changelog/fix-videopress-block-gutenberg-error diff --git a/projects/plugins/jetpack/changelog/fix-videopress-block-gutenberg-error b/projects/plugins/jetpack/changelog/fix-videopress-block-gutenberg-error new file mode 100644 index 0000000000000..7fba762c6a4d5 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-videopress-block-gutenberg-error @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Fix VideoPress load for old videos in Gutenberg diff --git a/projects/plugins/jetpack/extensions/blocks/videopress/save.js b/projects/plugins/jetpack/extensions/blocks/videopress/save.js index ee77f468a5a8c..27fdf3bd5f25d 100644 --- a/projects/plugins/jetpack/extensions/blocks/videopress/save.js +++ b/projects/plugins/jetpack/extensions/blocks/videopress/save.js @@ -65,7 +65,7 @@ const VideoPressSave = CoreVideoSave => props => { } ); let embedWrapperStyle = {}; - if ( maxWidth.length > 0 && '100%' !== maxWidth ) { + if ( maxWidth && maxWidth.length > 0 && '100%' !== maxWidth ) { embedWrapperStyle = { maxWidth, margin: 'auto',