Skip to content

Commit

Permalink
Fix the latest-posts block when imageDimensions is empty (#21070)
Browse files Browse the repository at this point in the history
Co-authored-by: roo2 <roo2@protonmail.com>
  • Loading branch information
2 people authored and whyisjake committed Apr 23, 2020
1 parent a8d470b commit bfc4fa6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/block-library/src/latest-posts/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,16 @@ export default withSelect( ( select, props ) => {
.map( ( { name, slug } ) => ( { value: slug, label: name } ) );

return {
defaultImageWidth: imageDimensions[ featuredImageSizeSlug ].width,
defaultImageHeight: imageDimensions[ featuredImageSizeSlug ].height,
defaultImageWidth: get(
imageDimensions,
[ featuredImageSizeSlug, 'width' ],
0
),
defaultImageHeight: get(
imageDimensions,
[ featuredImageSizeSlug, 'height' ],
0
),
imageSizeOptions,
latestPosts: ! Array.isArray( posts )
? posts
Expand Down

0 comments on commit bfc4fa6

Please sign in to comment.