Skip to content

Commit

Permalink
Post Author: Avoid errors when the user avatars are disabled (#45989)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored Nov 23, 2022
1 parent ca1bf14 commit f6d8343
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/block-library/src/post-author/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function PostAuthorEdit( {
attributes;
const avatarSizes = [];
const authorName = authorDetails?.name || __( 'Post Author' );
if ( authorDetails ) {
if ( authorDetails?.avatar_urls ) {
Object.keys( authorDetails.avatar_urls ).forEach( ( size ) => {
avatarSizes.push( {
value: size,
Expand Down Expand Up @@ -172,7 +172,7 @@ function PostAuthorEdit( {
</BlockControls>

<div { ...blockProps }>
{ showAvatar && authorDetails && (
{ showAvatar && authorDetails?.avatar_urls && (
<div className="wp-block-post-author__avatar">
<img
width={ attributes.avatarSize }
Expand Down

0 comments on commit f6d8343

Please sign in to comment.