Skip to content

Commit

Permalink
Ignore empty width attribute in columns
Browse files Browse the repository at this point in the history
The editor was crashing when attempting to render a column block which contained an empty width attribute (i.e `<!-- wp:column {"width":""} -->`.
The exception occurred when accessing a property of an undefined object, so adding a default object (`|| {}`) fixes this by allowing the property to be accessed.
  • Loading branch information
guarani committed Feb 16, 2021
1 parent 6ef9e82 commit 10eba54
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const getValueAndUnit = ( value, unit ) => {

const convertUnitToMobile = ( containerSize, globalStyles, value, unit ) => {
const { width, height } = containerSize;
const { valueToConvert, valueUnit } = getValueAndUnit( value, unit );
const { valueToConvert, valueUnit } = getValueAndUnit( value, unit ) || {};
const { fontSize = 16 } = globalStyles || {};

switch ( valueUnit ) {
Expand Down

0 comments on commit 10eba54

Please sign in to comment.