Skip to content

Commit

Permalink
avoid potential errors with non existing fontFace array
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenedetto committed Sep 8, 2023
1 parent 61f7db3 commit 43dae16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function getIntersectingFontFaces( incoming, existing ) {

if ( existingFont ) {
if ( incomingFont?.fontFace ) {
const matchingFaces = incomingFont.fontFace.filter(
const matchingFaces = ( incomingFont.fontFace || [] ).filter(
( face ) => {
return ( existingFont?.fontFace || [] ).find( ( f ) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function getPreviewStyle( family ) {

if ( family.fontFace ) {
//get all the font faces with normal style
const normalFaces = family.fontFace.filter(
const normalFaces = ( family.fontFace || [] ).filter(
( face ) => face.fontStyle.toLowerCase() === 'normal'
);
if ( normalFaces.length > 0 ) {
Expand Down

0 comments on commit 43dae16

Please sign in to comment.