Skip to content

Commit

Permalink
Prevent encoding colors for sides that aren't set
Browse files Browse the repository at this point in the history
Also prevents attempting to encode flat color for border object that is undefined.
  • Loading branch information
aaronrobertshaw committed Apr 6, 2023
1 parent 854ab4b commit 6aadf4c
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,14 @@ export default function BorderPanel( {

if ( hasSplitBorders( updatedBorder ) ) {
[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {
updatedBorder[ side ] = {
...updatedBorder[ side ],
color: encodeColorValue( updatedBorder[ side ]?.color ),
};
if ( updatedBorder[ side ] ) {
updatedBorder[ side ] = {
...updatedBorder[ side ],
color: encodeColorValue( updatedBorder[ side ]?.color ),
};
}
} );
} else {
} else if ( updatedBorder ) {
updatedBorder.color = encodeColorValue( updatedBorder.color );
}

Expand Down

0 comments on commit 6aadf4c

Please sign in to comment.